excelsior9
Programmer
Ok, I'm not sure what's wrong here. Basically, I'm executing this UNION query:
$query = "SELECT id,title,authorcomments,author,keywords,date_format(postdate, '%W %M %D, %Y') AS readable_date FROM artwork
WHERE authorcomments LIKE '%$trimmed%' OR title LIKE '%$trimmed%' OR keywords LIKE '%$trimmed%'
UNION SELECT id,title,poemtext,authorcomments,author,keywords,date_format(postdate, '%W %M %D, %Y') AS readable_date FROM poems
WHERE authorcomments LIKE '%$trimmed%' OR title LIKE '%$trimmed%' OR keywords LIKE '%$trimmed%' ORDER BY postdate DESC";
And I THINK that bit's fine... but when I try and deal with it with these PHP functions:
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
I get this error message:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/littlehe/public_html/etcetera2/search.php on line 83
Any ideas what's wrong?
$query = "SELECT id,title,authorcomments,author,keywords,date_format(postdate, '%W %M %D, %Y') AS readable_date FROM artwork
WHERE authorcomments LIKE '%$trimmed%' OR title LIKE '%$trimmed%' OR keywords LIKE '%$trimmed%'
UNION SELECT id,title,poemtext,authorcomments,author,keywords,date_format(postdate, '%W %M %D, %Y') AS readable_date FROM poems
WHERE authorcomments LIKE '%$trimmed%' OR title LIKE '%$trimmed%' OR keywords LIKE '%$trimmed%' ORDER BY postdate DESC";
And I THINK that bit's fine... but when I try and deal with it with these PHP functions:
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
I get this error message:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/littlehe/public_html/etcetera2/search.php on line 83
Any ideas what's wrong?