Advertisement
michaelyuen

Untitled

Jun 13th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. <?php
  2.     $query = "SELECT `menu_id`, `menu_name` FROM main_menu";
  3.     if ($result = mysqli_query($conn,$query)) { // execute the rest of script only when query is executed successfully
  4.             if (mysqli_num_rows($result) > 0) { // successfully executed query doesn't mean you must get the result
  5.                 WHILE ($row = mysqli_fetch_assoc($result)) {
  6.                     // use echo instead of mixing html and script (easier to manage and easier to comment out
  7.                     echo '<option value = "'.$num['menu_id'].'">'.$num['menu_name'].'</option>';               
  8.                 }
  9.             }
  10.         }
  11.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement