elexion Posted December 16, 2009 Share Posted December 16, 2009 hey everyone i've been trying to write a query that takes out a row out of my databaseand displays it in a drop down menu i've figured out how to make the drop down menu in HTML and the query is partly written too only problem is, It only takes out the first recordof my database. <?php$query = "SELECT * FROM vaksites WHERE vaksite != ''";mysql_select_db($query, $db);$result = mysql_query($query, $db) or die('the query failed');if(mysql_num_rows($result) > 0){ $rij = mysql_fetch_array($result); echo $rij['vaksite']; }else{echo ("failure");}?> Link to comment Share on other sites More sharing options...
AElliott Posted December 16, 2009 Share Posted December 16, 2009 The documentation for mysql_fetch_array has several examples of how to visit every row returned in the result resource using a while() loop structure. Examples #2-4 all do it, though example #3 is closest to the behaviour you want. Link to comment Share on other sites More sharing options...
elexion Posted December 16, 2009 Author Share Posted December 16, 2009 The documentation for mysql_fetch_array has several examples of how to visit every row returned in the result resource using a while() loop structure. Examples #2-4 all do it, though example #3 is closest to the behaviour you want.thanks man worked it out Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.