Jump to content

Help with query syntax


BarneyJoe

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.