php代
-
-
$hostname = "localhost"; - $username = "root";
- $password = "secret";
- $database = "prod";< ;/p>
if (IsSet ($_POST['submit'])) {
$dbh = new mysqli($hostname, $username, $password, $database);
/* 接続を確認します */
- if (mysqli_connect_errno()) {
- printf("Connect failed: %sn", mysqli_connect_error());
- exit ();
- }
- $dept_id = $_POST['dept_id'];< ;/p>
if ($result_set = $dbh->query("callemployee_list( $dept_id )")) {
- print ('
'.
- '
従業員ID | 姓 | 名 | ');
- while ($row = $result_set->fetch_object() ) {
- printf("
gt;%s | gt;%s | gt;%s | n", - $ row->employee_id, $row->surname, $row->firstname);
- }
- } else {
- printf("
エラー:%d (%s) %sn", mysqli_errno($ dbh),
- mysqli_sqlstate($dbh), mysqli_error($dbh));
- }
- print ("
");
- $dbh->close();
- }
- ?> p>
- 复制發
|