Guest User

Untitled

a guest
Dec 8th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Timesheet
  4. */
  5. get_currentuserinfo();
  6. global $current_user;
  7.  
  8. get_currentuserinfo();
  9. echo 'Logged In User: ' . $current_user->user_login . "\n";
  10. ?>
  11. <br>
  12. <?php
  13. $username="User";
  14. $password="Pass";
  15. $database="Database";
  16.  
  17. mysql_connect('localhost',$username,$password) or trigger_error( mysql_error() . " Unable to connect to database");
  18. mysql_select_db($database) or trigger_error( mysql_error() . " Unable to select database");
  19.  
  20. ?>
  21. <select name="Projects">
  22. <?php
  23. $sql = "SELECT ProjectName, ProjectID FROM Projects ORDER BY ProjectName";
  24.  
  25. $rs = mysql_query($sql) or trigger_error(mysql_error() . " unable to run query.");
  26.  
  27. while($row = mysql_fetch_assoc($rs))
  28. {
  29. echo "<option value=\"".$row['ProjectName']."\">".$row['ProjectID']."</option>\n ";
  30. }
  31. ?>
  32. </select>
Add Comment
Please, Sign In to add comment