顧客の e コマース バックエンドを構築しようとしています。私はこれまで何度もこのようなことをしてきましたが、自分自身をphpとmysqlの「新しい」とは考えていませんが、立ち往生していて何が悪いのかわかりません。
特定の場所にある mysql 行の内容を表示したいだけです (「WHERE」コマンドを使用)。
しかし、ページをロードすると、コンテンツ部分 (テーブル内) が空になります。その場所のテーブル内には間違いなくコンテンツがあり、ページ上の他のすべては実際の customerResults を除いて表示されます。
これが私のコードです:
<head>
<title>Customer Summary</title>
<?php
session_start();
require 'database_connect.php';
$customerTable = "customer";
if(isset($_GET['customer_click'])){
$customerId = $_GET['customer_click'];
}
?>
</head>
<h3>Customer <?php echo"$customerId"?></h3>
<table align="center" width="600px">
<tr>
<td><a href="index.php">Summary</a></td>
<td><a href="personal.php">Personal</a></td>
<td><a href="billing.php">Billing</a></td>
<td><a href="order_history.php">Order History</a></td>
</tr>
</table>
<table align="center" width="400px">
<tr>
<?php
$customerSelect = "SELECT * FROM $customerTable WHERE id = '$customerId' ";
$customerResult = mysql_query($customerSelect);
if (!$customerResult){
echo "No results, but why?!?!? </br/>";
}
if (mysql_num_rows($customerResult)==0){
echo "Results are empty...but why!?!?!";
}
while ($customerData = mysql_fetch_assoc($customerResult)){
echo $customerData['id'];
echo $customerData['email'];
}
?>
</tr>
</table>
私は単純なものを見落としている可能性がありますが、これを理解することはできません