dadamssg Posted May 24, 2009 Share Posted May 24, 2009 im trying to display the number of new messages next to an Inbox link....heres my code $me = $_SESSION['logname']; $cxn = mysqli_connect($host,$user,$passwd,$dbname) or die("Couldn't connect"); $sql = "SELECT * FROM Messages WHERE sentto = '$me' AND status='0'"; $result = mysqli_query($cxn,$sql) or die("Couldn't execute select query."); $count = mysqli_num_rows($result); and then i attempt to echo $count but its not outputting anything. the query works in phpmyadmin Link to comment https://forums.phpfreaks.com/topic/159444-solved-wont-count-contents/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 24, 2009 Share Posted May 24, 2009 Have you checked that $me contains what you think it does? Echo $sql to see what it actually contains. Link to comment https://forums.phpfreaks.com/topic/159444-solved-wont-count-contents/#findComment-841083 Share on other sites More sharing options...
dadamssg Posted May 24, 2009 Author Share Posted May 24, 2009 hey sorry, yeah i figured it out...this piece of code was in a function in a include file and i just noticed that that section wasn't inside the function i was calling on the page i was expecting results....thanks though! Link to comment https://forums.phpfreaks.com/topic/159444-solved-wont-count-contents/#findComment-841087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.