SilentK
05-28-2005, 06:09 PM
<?php
$reviews = $DB_site->query_first("
SELECT *
FROM " . TABLE_PREFIX . "thread AS thread
WHERE thread.forumid = 58 AND thread.visible = 1 AND thread.title like 'a%'
ORDER BY dateline DESC
");
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
echo($num_rows . " were found.<br>");
while($row = mysql_fetch_array($result) )
{
echo('<a href="http://www.xblteams.com/reviews.php?r=' . $row[threadid] . '">' . $reviews[title] . '</a><br />');
}
?> When I load up the page that uses that code I get this error
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /./././././reviews.html on line 131
were found.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /./././././reviews.html on line 134
I am a noob when it comes to mysql queries so I am not exactly sure what's going on, if it's a problem with the query or the way I try to loop it.
*edit* I posted this over at vbulletin.com and was told it was caused by mixing vbulletin classes and php classes. I am not really familier with vbulletin classes so I could use some help. I was told that I should ask here.
$reviews = $DB_site->query_first("
SELECT *
FROM " . TABLE_PREFIX . "thread AS thread
WHERE thread.forumid = 58 AND thread.visible = 1 AND thread.title like 'a%'
ORDER BY dateline DESC
");
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
echo($num_rows . " were found.<br>");
while($row = mysql_fetch_array($result) )
{
echo('<a href="http://www.xblteams.com/reviews.php?r=' . $row[threadid] . '">' . $reviews[title] . '</a><br />');
}
?> When I load up the page that uses that code I get this error
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /./././././reviews.html on line 131
were found.
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /./././././reviews.html on line 134
I am a noob when it comes to mysql queries so I am not exactly sure what's going on, if it's a problem with the query or the way I try to loop it.
*edit* I posted this over at vbulletin.com and was told it was caused by mixing vbulletin classes and php classes. I am not really familier with vbulletin classes so I could use some help. I was told that I should ask here.