Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>PHP MySQL Stored Procedure Demo 1</title>
- <!--<link rel="stylesheet" href="css/table.css" type="text/css" />-->
- </head>
- <body>
- <?php
- // require_once 'dbconfig.php';
- try {
- $pdo = new PDO("mysql:host=localhost;dbname=test", 'root', '');
- // execute the stored procedure
- $sql = 'CALL `test_pro`()';
- // call the stored procedure
- $q = $pdo->query($sql);
- $q->setFetchMode(PDO::FETCH_ASSOC);
- } catch (PDOException $e) {
- die("Error occurred:" . $e->getMessage());
- }
- ?>
- <table>
- <tr>
- <th>Customer Name</th>
- <th>Credit Limit</th>
- </tr>
- <?php while ($r = $q->fetch()): ?>
- <tr>
- <td><?php echo $r['name'] ?></td>
- <td><?php echo $r['age'] ?>
- </td>
- </tr>
- <?php endwhile; ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement