merc123 Posted April 9, 2008 Share Posted April 9, 2008 Hey guys had a problem that has me stumped. I've got a MySQL DB with the table called scr_results with the fields date, SLM and LLM. I just want the date field and to output it so I've tried the following below. It shows I have 2 results but it doesn't display anything and I can't remember an alternative to print_r to see the array of the query. Also, there are no errors. include_once("../connect.php"); //Connect to DB $query= mysql_query("SELECT `date` FROM `scr_results`") or die(mysql_error()); $result= mysql_numrows($query); //Return 2 fields if ($result == '0') { echo "No results found. You need to add some first."; echo "<HR><a href=>Back to Administration Console</a><BR>"; exit; } if ($result == '1') { while ($row=mysql_fetch_array($query)) { echo $row['date']; } } Link to comment https://forums.phpfreaks.com/topic/100392-php-mysql-issue-results-from-query-but-no-output/ Share on other sites More sharing options...
merc123 Posted April 9, 2008 Author Share Posted April 9, 2008 Nevermind, as soon as I posted it I saw the error. if ($result == '1') should be if ($result >= '1') Link to comment https://forums.phpfreaks.com/topic/100392-php-mysql-issue-results-from-query-but-no-output/#findComment-513379 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.