Why does this not work? :(

A

Anonymous

Guest
Again, dont mind me, I'm very noobish to PHP........ :oops:

Sample code:
-----------------------------------------------------------------------------
// sending query to database
$query_coupontypes = mysql_query ("SELECT coupon_id, percentage_discount, description FROM coupontypes");
$query_coupons = mysql_query ("SELECT status, purchase_amount, retailer_ordernum FROM coupons");
$query_user = mysql_query ("SELECT username FROM users ");

// displaying data on a table
while ( $a_row = mysql_fetch_array($query_coupontypes)) {
print "<TR align=center>";
print "<TD width=100> $a_row[coupon_id] </TD>";
print "<TD width=100> $a_row[percentage_discount] </TD>";
print "<TD width=100> $a_row[description] </TD>";
}
while ( $b_row = mysql_fetch_array($query_coupons)) {
print "<TD width=100> $b_row[status] </TD>";
print "<TD width=100> $b_row[purchase_amount] </TD>";
print "<TD width=100> $b_row[retailer_ordernum] </TD>";
}
while ( $c_row = mysql_fetch_array($query_users)) {
print "<TD width=100> $c_row[username] </TD><TR>";
-----------------------------------------------------------------------------

The middle WHILE statement works but the bottom and top doesnt...
I gives me 2 error message for both the top and bottom WHILE statements that looks like this:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /pub/www/htdocs/admin-b/coupons/Report2_basic.php on line 31

pls pls pls help.......
 
Thank you, that helped me find out the errors, now this page is working :D
 
Back
Top