Aureole Posted July 22, 2007 Share Posted July 22, 2007 It looks fine to me, but it isn't returning any results but there are results in the database. I do connect to the database but that's earlier on in the page...just so you know. <?php $query = "SELECT wnewsstoryid, wnewstitle, wnewsshortstory, wnewsfullstory, wnewsauthor, wnewscategory, wnewsmemberid, DATE_FORMAT(date, '%d %M, %Y') FROM news ORDER BY date DESC"; $result = @mysql_query($query); if (mysql_num_rows($result)>0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<a href=\"http://www.veraci7y.net/news/read.php?id="; echo $row['wnewsstoryid']; echo "\" target=\"_blank\" title=\"Read full story...\" class=\"newstitle\">"; echo $row['wnewstitle']; echo "</a>"; echo "<p class=\"newsinfo\">Posted by <a href=\"http://www.veraci7y.net/forums/index.php?showuser="; echo $row['wnewsmemberid']; echo "\" class=\"user\" title=\"View Member's Profile\">"; echo $row['wnewsauthor']; echo "</a></p>"; echo "<p class=\"newscontent\">"; echo $row['wnewsshortstory']; echo "</p><br />"; } } else { echo "There are no news posts to display."; } ?> Link to comment https://forums.phpfreaks.com/topic/61237-solved-anything-wrong-with-this-mysql-query/ Share on other sites More sharing options...
Barand Posted July 22, 2007 Share Posted July 22, 2007 first step: Check for error messages $result = @mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/61237-solved-anything-wrong-with-this-mysql-query/#findComment-304662 Share on other sites More sharing options...
Aureole Posted July 22, 2007 Author Share Posted July 22, 2007 Ok I'll do that now, I really need to get into the habit of checking for error messages... Link to comment https://forums.phpfreaks.com/topic/61237-solved-anything-wrong-with-this-mysql-query/#findComment-304670 Share on other sites More sharing options...
Aureole Posted July 22, 2007 Author Share Posted July 22, 2007 Ok this is getting annoying now... If you go to www.veraci7y.net/test.php ...you will see the query is working fine. Now go go www.veraci7y.net/index.php click on the "Misc" in the left column. It's the EXACT same code, it works on test.php but not on index.php...what gives? Link to comment https://forums.phpfreaks.com/topic/61237-solved-anything-wrong-with-this-mysql-query/#findComment-304675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.