$sql = "SELECT * FROM `myDataBase.myTable`";
if ( $result = @mysql_query ( $sql ) ) {
while ( $data = @mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
print_r ( $data );
}
@mysql_free_result ( $result );
} else {
echo ( mysql_error() );
}
Jim Hatridge wrote:
HI all, In the code below I'm trying to get the last column to show 1, 2, 3, or 4 according to which quarter of the year it is. But all it shows in that column is " Resource ID # X". The X starts with #3 and goes to 18. There are (at the moment) 15 items in the table. Any ideas what's wrong?Thanks JIM ############################# <?php echo "<table border=1> \n"; $i=1; while ($myrow = mysql_fetch_array($result)) { if($i % 2) { //this means if there is a remainder echo "<TR bgcolor=\"yellow\">\n"; } else { //if there isn't a remainder we will do the else echo "<TR bgcolor=\"white\">\n"; } $qdate=$myrow["date"]; $sql = "select quarter($qdate)" or die("not work #3"); $yyy = mysql_query ($sql) or die("not work #4"); printf("<td><a href=\"%s?id=%s&delete=yes\">Delete</a></td>", $PHP_SELF, $myrow["id"]); printf("<td><a href=\"%s?id=%s&submit=yes\">Update</td><td>%s</td><td> %s</td><td> %s</td></a></tr>", "update-inv.php", $myrow["id"], $myrow["name"], $myrow["details"], $yyy); $i=$i+1; } echo "</table>\n"; } ?> #############################
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php