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

Recommended Answers

All 2 Replies

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.

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/>";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.