ユーザー入力を受け取り、関連する請求書を返すことになっている html フォームを作成しました。エラーは発生していません。HTML コードをチェックして、isset の条件が正しいことを確認しました。また、PHPAdmin でクエリをテストしました (求めている情報が返されます)。ただし、請求書は画面に出力されず、エラーや PHP コードも出力されません。画面に表示されるのは、タイトル (html は表示されません) とハイパーリンク (html は表示されません) だけです。以下は、関連する PHP コードのセクションです。前もって感謝します。
if( isset($_POST["submit"] )) {
if (!($stmt =$mysqli->prepare("SELECT DISTINCT INVOICE.date, CUSTOMER.Name, CUSTOMER.Lname, CUSTOMER.Phone, CUSTOMER.Address, CUSTOMER.email, INVOICE.Invoice_num, INVOICE.Itm_num, INVOICE.Itm_Price, INVOICE.Discount, INVOICE.Total
FROM CUSTOMER, INVOICE
WHERE CUSTOMER.Phone = INVOICE.Cust_phone AND CUSTOMER.Lname = INVOICE.Cust_lname AND
(CUSTOMER.Name = ? OR CUSTOMER.Lname = ? OR INVOICE.date = ? OR INVOICE.Invoice_num = ? OR INVOICE.Itm_num = ?)
GROUP BY date;"))) {
print "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
if (!$stmt->bind_param("sssis",$_POST['fname'], $_POST['lname'], $_POST['date'], $_POST['invoice_num'], $_POST['item_num'])) {
print "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}
if (!$stmt->execute()) {
print "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
$stmt->store_result();
if (!$stmt->bind_result($date, $Fname, $Lname, $Phone, $Address, $Email, $Invoice_num, $Item_num, $Itm_Price, $Discount,$Total)) {
print "Binding output parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}
if ($stmt->num_rows == 0){
print "No results were found for the following search <p>".$_POST['fname'].$_POST['lname'].$_POST['date'].$_POST['invoice_num'].$_POST['item_num']."</p>";
}
else {
print "<table border=2 cellpadding=4>
<tr bgcolor=white>
<th>Date</th>
<th>First Name</th>
<th>Last Name</th>
<th>Phone</th>
<th>Address</th>
<th>Email</th>
<th>Invoice #</th>
<th>Item #</th>
<th>Price</th>
<th>Discount (if applicable)</th>
<th>Total</th>
</tr>";
while ($stmt->fetch()) {
print "<tr><td>".$date."</td>
<td>".$Fname."</td>
<td>".$Lname."</td>
<td>".$Phone."</td>
<td>".$Address."</td>
<td>".$Email."</td>
<td>".$Invoice_num."</td>
<td>".$Itm_num."</td>
<td>".$Itm_Price."</td>
<td>".$Discount."</td>
<td>".$Total."</td></tr>";
}
print "</table>";
}
$stmt->free_result();
}
どんな提案でも大歓迎です。