SilentSorrow

Select PHP

Feb 7th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. ?>
  2. <select name="names">
  3. <?php
  4. $query = mysql_query("select username from users order by user_id ASC");
  5.  
  6. if(mysql_num_rows($query) >0){
  7. //output data
  8. while ($row = mysql_fetch_assoc($query)){
  9. echo "<option name=\"". $row['username']. "\">" . $row['username'] . "<option/>";
  10. }
  11. }
  12. else{
  13. echo "error";
  14. }
  15. ?>
  16. </select>
Advertisement
Add Comment
Please, Sign In to add comment