I am trying to build a customer e-commerce backend. I've done stuff like this many times before and don't consider myself "new" to php & mysql, but I am stuck and can't figure out what is wrong.
I just want to display the content of a mysql row at a specific location (using the "WHERE" command).
But when I load the page, the content part (in the tables) comes up empty. There is definitely content within the table at that location and everything else on the page displays EXCEPT for the actual customerResults.
Here is my code:
<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>
I could be over-looking something simple, but I really can't figure this out
Customer
" shows the correct CustomerId – paulcruse3 Jul 26 '12 at 18:52