wright67uk Posted April 8, 2011 Share Posted April 8, 2011 Hello, Im trying to display some results from mysql database, however none display. Can anyone tell me where im going wrong please? </head><body> <div id="listhold"> <div class="list"> <a href="Restaurants.html">Restaurants</a><br /> <?php mysql_connect("","",""); mysql_select_db("") or die("Unable to select database"); $result = mysql_query("SELECT name FROM business WHERE type ='restaurant' ORDER BY name"); $number_of_results = mysql_num_rows($result); $results_counter = 0; if ($number_of_results != 0) {while ($array = mysql_fetch_array($result)) $results_counter++; if ($results_counter >= $number_of_results);} ?> </div> Quote Link to comment https://forums.phpfreaks.com/topic/233135-no-results-displaying/ Share on other sites More sharing options...
Pikachu2000 Posted April 8, 2011 Share Posted April 8, 2011 You have nothing in that code that would display anything. There's no echo, print, etc. Quote Link to comment https://forums.phpfreaks.com/topic/233135-no-results-displaying/#findComment-1198977 Share on other sites More sharing options...
Maq Posted April 8, 2011 Share Posted April 8, 2011 Well you don't output anything, try: {while ($array = mysql_fetch_array($result)) $results_counter++; echo $array['name']; if ($results_counter >= $number_of_results);} Quote Link to comment https://forums.phpfreaks.com/topic/233135-no-results-displaying/#findComment-1198978 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.