i am having trouble with what seems quite a simple select query, i know there are lots of tutorials out there for this, but none seem to work for me, i keep getting the
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
Error
Here is the query causing it, basically i just want to select from 2 different tables
$trash_statement = "SELECT * FROM user_inbox, user_outbox WHERE user_inbox.receiver_user_id='$user_id' AND user_outbox.sender_user_id='$user_id' AND mail_deleted='1'";
Any ideas, where i am going wrong?
Thanks
mail_deleted is not associated with any table name! That causes Mysql to return an error and not a resource as expected by mysql_fetch_assoc() .
MySql Error: saying that the field name is not related to anything
#1052 - Column 'mail_deleted' in where clause is ambiguous
YOUR QUERY
$trash_statement = "
SELECT *
FROM user_inbox, user_outbox
WHERE user_inbox.receiver_user_id='$user_id'
AND user_outbox.sender_user_id='$user_id'
AND yourTableName.mail_deleted='1'";
FIX THIS:
... yourTableName .mail_deleted...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.