Hi!
I got a little problem hopefully easy to solve.
In my admin i have coded that when an administrator adds a new artist they can choose to either make a phpbb forum section for the artist automatically or dont make one, just a checkbox tick to add forum... dont tick no forum. I am sure you get the picture.
I have created 3 artists as a test, 2 with forums sections and 1 without.
Artist 1: Has a topic in there forum section.
Artist 2: Does not have a topic in there forum section.
Artist 3: Has no forum section.
Ok so on the artist page in the website, i want to it show the latest 5 topics, now for artist 1 this works no problem. Artist 2 doesnt have a topic so nothing shows which is correct. Artist 3 causes a mysql error... why does it not just show nothing like artist 2?
Heres my code:
The two errors i am getting are (i have arrowed in the php code where the errors are pointing):PHP Code:<?
$resulta = mysql_query("SELECT * FROM tartists_forums WHERE artistid = $id");
$rowa = mysql_fetch_array($resulta);
$forumid = $rowa['forumid'];
$resultb = mysql_query("SELECT * FROM phpbb_topics WHERE forum_id = $forumid");
$rowb = mysql_num_rows($resultb); //<<<< Error 1
$c = $rowb;
if ($c != '0') {
?>
<br/><br/><br/><span class="news_title">Forums</span><br/><br/>
<span class="news_info">You need to be registered on our forums to view these topics.</span><br/><br/>
<?
$i=1;
$resultc = mysql_query("SELECT * FROM phpbb_topics WHERE forum_id = $forumid ORDER BY topic_id ASC LIMIT 0,5");
while ($rowc = mysql_fetch_array($resultc)) { //<<<< Error 2
$topicid = $rowc['topic_id'];
$topictitle = $rowc['topic_title'];
echo '<span class="news_info">'.$i.': </span> <a href="/forums/viewforum.php?f=' . $topicid . '" target="_blank" class="view_link">' . $topictitle . "</a><br>\n";
$i++;
}
}
?>
Any help would be very greatfulCode:Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/grand/public_html/test/artists.php on line 525 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/grand/public_html/test/artists.php on line 541
Thanks
Aaron



Reply With Quote

Bookmarks