runnerjp Posted April 10, 2009 Share Posted April 10, 2009 i need to be able to display a message if a users has not posted anything in the forum.... im not sure how to get this right... here is my attempt <?php $sql = "Select * FROM forumtutorial_posts where author = '$profilename' ORDER BY `showtime` DESC LIMIT 0, 5"; $postsresult = mysql_query($sql) or die("Could not get threads"); while($row = mysql_fetch_assoc($postsresult)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a> <br />' ;} [b]if ($postresults < 0)[/b] {echo 'user has yet to make a post.';}?> Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 10, 2009 Share Posted April 10, 2009 Something like so: if(mysql_num_rows($postresult) == 0) { echo 'You have not made a post...'; } Quote Link to comment Share on other sites More sharing options...
runnerjp Posted April 10, 2009 Author Share Posted April 10, 2009 i get Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/runningp/public_html/members/include/profile.php on line 139 user has yet to make a post. Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted April 10, 2009 Share Posted April 10, 2009 Can you show us the updated code. Quote Link to comment Share on other sites More sharing options...
runnerjp Posted April 10, 2009 Author Share Posted April 10, 2009 completed it .... this is what i did! <?php $result = mysql_query("SELECT * FROM pb where uid='".$getuser['ID']."' Order by pb") or die(mysql_error()); $num2 = mysql_num_rows($result); if($num2 < 1) {echo 'what ever';} Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 10, 2009 Share Posted April 10, 2009 Sick. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.