•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,986 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,650 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1356 | Replies: 2
![]() |
•
•
Join Date: Feb 2005
Posts: 20
Reputation:
Rep Power: 4
Solved Threads: 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
Any help would be great!
Thanks
do you have any code at this point??
would look something like this....
[php]$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]";
} [/php]
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.
would look something like this....
[php]$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]";
} [/php]
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:
[php]
$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/>";
}
[/php]
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['id'] and you can use that like this:
[php]
$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/>";
}
[/php]
[php]
$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/>";
}
[/php]
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['id'] and you can use that like this:
[php]
$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/>";
}
[/php]
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Need Opinion (Search Engine Optimization)
- Help needed with video/audio on site pages (Graphics and Multimedia)
- Download manager script needed (Existing Scripts)
- linked stack question. (C)
- Bug when creating linked lists in Dev C++ (C++)
- Linked Lists stresses (C++)
- C/ Need Help with Linked Lists please (C)
Other Threads in the PHP Forum
- Previous Thread: php mysql help
- Next Thread: phpMyAdmin problems


Linear Mode