Guest User

Untitled

a guest
Jul 21st, 2018
77
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. global $user;
  3. echo "This is page 1. You are $user->name.<br />";
  4.  
  5. // Connecting, selecting database
  6. db_set_active('test');
  7.  
  8. // Performing SQL query
  9. $query = 'SELECT id, product_name, created_at, updated_at FROM cims_build ORDER BY created_at DESC LIMIT 10';
  10. $result = mysql_query($query) or die('Query failed: ' . mysql_error());
  11.  
  12.  
  13. // Printing results in HTML
  14. echo "<table>\n";
  15. while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
  16. echo "\t<tr>\n";
  17. foreach ($line as $col_value) {
  18. echo "\t\t<td>$col_value</td>\n";
  19. }
  20. echo "\t</tr>\n";
  21. }
  22. echo "</table>\n";
  23.  
  24. // Free resultset
  25. mysql_free_result($result);
  26.  
  27. db_set_active('default');
Add Comment
Please, Sign In to add comment