I can't get my NOT EXISTS mysql statement to work and it's driving me mad now:
$ancestors = mysql_query('
SELECT * FROM comments e
WHERE
ancestors = "' . $comment["id"] . '" AND
user_id != "' . $user->user_object["id"] . '" AND
NOT EXISTS
(
SELECT null
FROM notifications d
WHERE d.target_id = e.id
)
', $database->connection_handle);
Any ideas?
ERROR:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /<>/<>/functions.php on line 785
Line 785:
while($reply = mysql_fetch_array($ancestors, MYSQL_ASSOC)){
If I do this:
$ancestors = mysql_query('SELECT * FROM ' . $database->db_prefix . 'comments
WHERE
ancestors = "' . $comment["id"] . '" AND
user_id != "' . $user->user_object["id"] . '"',
$database->connection_handle
);
It returns my results i expect.
the notifications table does contain an entry
mysql var dump =
string(46) "Table 'whatever_co.comments' doesn't exist"
//SOLVED::: ' . $database->db_prefix . ' was missing from my table selectors.