Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>PHP MySQL Stored Procedure Demo 1</title>
  5. <!--<link rel="stylesheet" href="css/table.css" type="text/css" />-->
  6. </head>
  7. <body>
  8. <?php
  9. // require_once 'dbconfig.php';
  10. try {
  11. $pdo = new PDO("mysql:host=localhost;dbname=test", 'root', '');
  12. // execute the stored procedure
  13. $sql = 'CALL `test_pro`()';
  14. // call the stored procedure
  15. $q = $pdo->query($sql);
  16. $q->setFetchMode(PDO::FETCH_ASSOC);
  17. } catch (PDOException $e) {
  18. die("Error occurred:" . $e->getMessage());
  19. }
  20. ?>
  21. <table>
  22. <tr>
  23. <th>Customer Name</th>
  24. <th>Credit Limit</th>
  25. </tr>
  26. <?php while ($r = $q->fetch()): ?>
  27. <tr>
  28. <td><?php echo $r['name'] ?></td>
  29. <td><?php echo $r['age'] ?>
  30. </td>
  31. </tr>
  32. <?php endwhile; ?>
  33. </table>
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement