SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 143 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $servername = "localhost";
  3. $username = "test";
  4. $password = "Qwe@123456";
  5. $dbname = "mydb";
  6. $conn = mysqli_connect($servername,$username,$password,$dbname);
  7. if (!$conn){
  8.    die("Connection failed: " . mysqli_connect_error());
  9. }
  10. mysqli_query("set names utf8");
  11. $data = mysqli_query("select * from mydb");
  12. ?>
  13. <!DOCTYPE html>
  14. <head>
  15. <meta charset = "utf-8" >
  16. <title>reverse mysql to php </title>
  17. </head>
  18.  
  19. <body>
  20. <p>
  21.  
  22. </p>
  23. <table width = "700" border ="1">
  24.   <tr>
  25.      <td>ID</td>
  26.      <td>f</td>
  27.      <td>direction</td>
  28.   </tr>
  29.  
  30. <?php
  31.  
  32. for($i = 1;$i<=mysqli_num_rows($data);$i++) {
  33. $rs = mysqli_fetch_row($data);
  34. ?>
  35.  
  36.   <tr>
  37.      <td><?php echo $rs[0]?></td>
  38.      <td><?php echo $rs[1]?></td>  
  39.      <td><?php echo $rs[2]?></td>
  40.   </tr>
  41. <?php
  42. }
  43. ?>
  44. </table>
  45. <p>&nbsp;</p>
  46. </body>
  47. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top