Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\classes\Trade.class.php on line 12

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\classes\Trade.class.php on line 19

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\classes\Trade.class.php on line 70

Line 12

while ( $trade_users_row = mysql_fetch_array($trade_users_query) )

Line 19

while ($trade_items = mysql_fetch_array($trade_items_query) )

Line 70

$quantity_result = mysql_fetch_assoc( $quantity_query );

I can't figure out what I've done wrong.

Any help would be much appreciated :)

It might help to know what you have assigned to $trade_users_query, $trade_items_query and $quantity_query.

Most likely there was an error in the query you executed. Read this thread first.

My problem was I forgot to create the table I was trying to query.

Thanks anyway.

Select the database mysql_select_db($database, $con); and all is fixed!

Your mysql query return no values. So you got this error. To avoid this error, you need to add die(mysql_error()) after your query

ie,

mysql_query("select * from tbl_name") or die(mysql_error());

If the query is not correct, then it give error message. Now you can know whether your query return values or not

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.