Guest User

Untitled

a guest
Dec 24th, 2017
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. $username="User";
  3. $password="Pass";
  4. $database="database";
  5. mysql_connect('localhost',$username,$password) or trigger_error( mysql_error() . " Unable to connect to database");
  6. mysql_select_db($database) or trigger_error( mysql_error() . " Unable to select database");
  7. ?>
  8.  
  9.  
  10. <?php
  11. $query = mysql_query('SHOW COLUMNS FROM `WorkActivity`');
  12. if (mysql_num_rows($query) > 0) {
  13. echo '<select name="" id="">';
  14. foreach (mysql_fetch_assoc($query) as $row) {
  15. if ($row['Field'] !== 'ID') echo '<option value="' . $row['Field'] . '">' . $row['Field'] . '</option>' . "\n";
  16. }
  17. echo '</select>';
  18. } else {
  19. echo 'Nothing in database';
  20. }
  21.  
  22. ?>
Add Comment
Please, Sign In to add comment