Jump to content

Recommended Posts

Hope someone can help with this, as I'm still a bit new to this.

 

Basically have one table Orders, and another OrderDetails.

 

Have a page that lists Orders (simply based on the Orders table), and the user can click through to view the OrderDetails using the code :

 

<a href="orderdetails.php?ID=<?php echo $row_rsOrders['OrderID']; ?>"><?php echo $row_rsOrders['VendorTxCode']; ?></a>

 

Which works fine.

 

However, I want to show on the Details page a couple of fields from the Orders Table - ie OrderTotal and VendorTxCode.

 

My query at the moment looks like :

 

SELECT * FROM Orders, OrderDetails WHERE Orders.OrderID = OrderDetails.DetailOrderID

 

But think I need to use a JOIN (INNER) so that it knows which record to use based on the current OrderID, as the above is showing the values from the first record in the Orders table.

 

If anyone can help out with the syntax, that would be much appreciated.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/77539-help-with-query-syntax/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.