itsureboy Posted February 27, 2007 Share Posted February 27, 2007 I have a php script to retrieve data from a table in a database. However i get nothing in return. Below are example of the table and my php..... What am I doing wrong? **There are no connection problems.** Thanks in advance.... For example I have a table somewhat like this in my database. color |||||| type |||| ------------------------- blue |||||| shirt |||| <?php include 'dbconnect.php'; $query = mysql_query("SELECT type FROM mytable WHERE color = 'blue' "); $row = mysql_fetch_assoc($query); echo $row['type']; ?> Link to comment https://forums.phpfreaks.com/topic/40407-getting-no-data-in-return-with-php-mysql/ Share on other sites More sharing options...
simcoweb Posted February 27, 2007 Share Posted February 27, 2007 Try changing to this: <?php include 'dbconnect.php'; $query = mysql_query("SELECT type FROM mytable WHERE color = 'blue' "); while ($row = mysql_fetch_array($query)) { echo "" . $row['type'] . "<br\ >\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/40407-getting-no-data-in-return-with-php-mysql/#findComment-195542 Share on other sites More sharing options...
itsureboy Posted February 27, 2007 Author Share Posted February 27, 2007 It worked!! Thank you so much.... Link to comment https://forums.phpfreaks.com/topic/40407-getting-no-data-in-return-with-php-mysql/#findComment-195563 Share on other sites More sharing options...
simcoweb Posted February 27, 2007 Share Posted February 27, 2007 No problem Link to comment https://forums.phpfreaks.com/topic/40407-getting-no-data-in-return-with-php-mysql/#findComment-195568 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.