0

I have a mysql database that has three tables. customers, orders, and order details. I want my customer to logon using a username and password that will show a list of his current orders. From there I want to be able to click on any given order and see the order details.
Any help would be great!
Thanks

3
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by RamiroS
0

do you have any code at this point??

would look something like this....

$get_orders  = mysql_query("SELECT * FROM orders WHERE member id = '$member_id' ORDER BY order_id");
  while($myorder = mysql_fetch_array($get_orders)){
    echo "$myorder[order_id]";
}

That would at least display all the order id numbers.... turn those into links and send to a page that would do something with that number, like display the order and junk..... hope that helped a bit.

0

Following the example cjgraphix gave you:

$get_orders  = mysql_query("SELECT order_id, ordername FROM orders WHERE member id = '$member_id' ORDER BY order_id");
  while($myorder = mysql_fetch_array($get_orders)){
    echo "<a href='viewdetail.php?id=" . $myorder['order_id'] . "'>".$myorder['order_id']."</a> " . $myorder['order_name'] . "<br/>";
}

then having a viewdetail.php file (check how the link is constructed in the example) you will receive the id as a GET variable $_GET and you can use that like this:

$id=$_GET['id']+0; # adding +0 solves some issues with false ids
 $get_order_info  = mysql_query("SELECT * FROM orders WHERE order_id = '$id'");
  while($myorder = mysql_fetch_array($get_order_info)){
    echo "Order ID: " . $myorder['order_id'] . "<br/>";
    echo "Order Name: " . $myorder['order_name'] . "<br/>";
    echo "Order Description: " . $myorder['order_description'] . "<br/>";
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.