Advertisement
Guest User

phpcode

a guest
Mar 26th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors',1);
  4. error_reporting(E_ALL);
  5.  
  6. mysql_connect('localhost', 'root', '');
  7.  
  8. mysql_select_db('testdb');
  9.  
  10. $result = mysql_query('select * from products');
  11.  
  12. $numrows = mysql_numrows($result);
  13.  
  14. //****************************************************************
  15. print "<table border = 3 style = width:400px>";
  16.  
  17.  
  18. for($i = 0; $i < $numrows; $i++)
  19. {
  20. $row = mysql_fetch_row($result);
  21.  
  22. print "<tr>";
  23.  
  24.  
  25. foreach($row as $cell)
  26. {
  27.  
  28. print "<td>";
  29. print $cell;
  30. print "</td>";
  31.  
  32.  
  33. }
  34. print "</tr>";
  35.  
  36.  
  37. }
  38.  
  39.  
  40.  
  41. print "</table>";
  42.  
  43.  
  44. mysql_close();
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement