How can i retrieve the ordered products by user, and display them?
I have 2 Tables: Orders_good & Users, if someone register all wil go into users, and if someone order a product everything will go in orders_good.
Everything is working fine, but except 1 thing.
After the user will submit a order, i want that they will see their ordered products on their page.
So let say i want to do this : If the user is logged in, then search the name in the Table: ('orders_good").. And if find that name in that table then search if he has some products orders, if yes: then show the orders, row by row, if no then show: No orders Yet .....
The table: orders_good, haves 2 columns: user_name & product_order
I am tyring with this, the User_Name session is working.
But how can i show the users their ordered products row by row???
$sql = "SELECT * FROM orders";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
session_id($id);
session_start();
echo $_SESSION['user_name'];
echo $row["product_order"];
This is the DB structure: