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']; ?> Quote Link to comment 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"; } ?> Quote Link to comment Share on other sites More sharing options...
itsureboy Posted February 27, 2007 Author Share Posted February 27, 2007 It worked!! Thank you so much.... Quote Link to comment Share on other sites More sharing options...
simcoweb Posted February 27, 2007 Share Posted February 27, 2007 No problem Quote Link to comment 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.