Sql Code and show utility
Hi Guys,
Could someone with Sql experience check my code please.
This is what I am trying to do.
I have a DetailProductID column in my database that has either a 1 or 2 written to it.
and I want an image / link to show if its a 1 and a different image / link if its 2.
This is what i have so far.
My Sql for DetailProductID with 1
SELECT users.UserID, orders.OrderUserID, orders.OrderID, orderdetails.DetailOrderID, orderdetails.DetailProductID
FROM users, orders, orderdetails
WHERE orders.OrderID = orderdetails.DetailOrderID AND orderdetails.DetailOrderID = orders.OrderID AND orderdetails.DetailProductID = 1 AND users.UserID = paramUserID
paramUserID Varibles with $_GET['UserID']
My php code
<?php if ($row_rsCourse1['DetailProductID'] == 1) { // Show if column... ?>
<span> <a href="users_ST_update.php?UserID=<?php echo($row_WADAusers["UserID"]); ?>"><img src="images/ST500DetailButton.png" alt="" width="200" height="38" /></a></span>
<?php } // Show if column... ?>
My Sql for DetailProductID with 2
SELECT users.UserID, orders.OrderUserID, orders.OrderID, orderdetails.DetailOrderID, orderdetails.DetailProductID
FROM users, orders, orderdetails
WHERE orders.OrderID = orderdetails.DetailOrderID AND orderdetails.DetailOrderID = orders.OrderID AND orderdetails.DetailProductID = 2 AND users.UserID = paramUserID
paramUserID Varibles with $_GET['UserID']
My php code
<?php if ($row_rsCourse2['DetailProductID'] == 2) { // Show if column... ?>
<span> <a href="users_ST_update.php?UserID=<?php echo($row_WADAusers["UserID"]); ?>"><img src="images/ST500DetailButton.png" alt="" width="200" height="38" /></a></span>
<?php } // Show if column... ?>
At the moment all I am getting is the image and link for DetailProductID 1 for both
Am I over thinking this?
I have added my page code to the attachments.
Any help would be greatly appreciated.
Kind regards
Jonathon