User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Feb 2005
Posts: 20
Reputation: Stick is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Stick Stick is offline Offline
Newbie Poster

Creating linked pages

  #1  
Feb 25th, 2005
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Location: Long Beach
Posts: 5
Reputation: cjgraphix is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cjgraphix's Avatar
cjgraphix cjgraphix is offline Offline
Newbie Poster

Re: Creating linked pages

  #2  
Feb 28th, 2005
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.
Reply With Quote  
Join Date: Mar 2005
Location: Costa Rica
Posts: 46
Reputation: RamiroS is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
RamiroS's Avatar
RamiroS RamiroS is offline Offline
Light Poster

Re: Creating linked pages

  #3  
Mar 10th, 2005
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]
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:49 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC