-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.php
37 lines (32 loc) · 961 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!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
include './config/db_connection.php';
$conn = OpenCon("root","");
try {
$sql = 'CALL GetCustomers()';
// call the stored procedure
$q = $conn->query($sql);
$q->setFetchMode(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Error occurred:" . $e->getMessage());
}
?>
<table>
<tr>
<th>Customer Name</th>
</tr>
<?php while ($r = $q->fetch()): ?>
<tr>
<td><?php echo $r['first_name'] ?></td>
</td>
</tr>
<?php endwhile; ?>
</table>
</body>
</html>