Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. $servername = "localhost";
  2. $username = "root";
  3. $password = "root";
  4. $dbname = "myDB";
  5.  
  6.  
  7. $conn = new mysqli($servername, $username, $password, $dbname);
  8.  
  9. if ($conn->connect_error) {
  10. die("Connection failed: " . $conn->connect_error);
  11. }
  12.  
  13. $sql = "SELECT id, firstname, lastname FROM tablenamehere ORDER BY id DESC LIMIT 500";
  14. $result = $conn->query($sql);
  15.  
  16. if ($result->num_rows > 0) {
  17.  
  18. while($row = $result->fetch_assoc()) {
  19. echo "<p>". $row["firstname"]. " " . $row["lastname"] . "</p>";
  20. }
  21. } else {
  22. echo "0 results";
  23. }
  24.  
  25. $conn->close();
  26.  
  27. $sql = "SELECT id, firstname, lastname FROM tablenamehere ORDER BY id DESC LIMIT 500";
  28. $result = $conn->query($sql);
  29.  
  30. <html>
  31. <body>
  32. <a href="test1.php?a=newtable">Register Now!</a>
  33. </body>
  34. </html>
  35. <?php
  36.  
  37. session_start();
  38. ?>
  39.  
  40. <?php
  41. if(isset($_GET['a'])){
  42. $_SESSION['link']=$_GET['a'];
  43. }
  44.  
  45. echo "the veriable is " . $_SESSION['link'] . "<br>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement