Im calling a list of my products that will show in a table but I dont have the right code to show for the 'next query here. What is proving difficult is paypal sends back info to a table PAYPAL with (item number) which matches the order number (order_id) of the ORDERS table.
OK the ORDERS number is where the products_id's are that have been purchased if multiple products are purchased per order I want to identify these product_ids and sort them with a their respective hyperlink to the product info.
What I want to do is run a query that will give the hyperlink to the (available) products in the original 'sql query' and no hyperlink for the products (purchased) that are in the ORDER table verified by Paypal. This should be simple but my coding is limited when it comes to comparing with other tables.
Can anybody help me complete this query?
THIS IS A STRIPPED DOWN IDEA OF MY CODE
Thanks anybody that can help me!!
<--start table-->
<table border="0" cellpadding="0" cellspacing="1" align="center">
<tr>
<?php
$sql_query = query("select products_id, itemname, itemnumber from PRODUCTS, CATEGORIES where products products_id = categories products_id ");
while ($sql = fetch_array($sql_query)) {
?><td>
$next_query=query("select product_id from ORDERS, PAYPAL where ORDERS orders_id = paypal item_number and PAYPAL result = VERIFIED");
// i dont know what is right thing to do next its all wrong and what i get is lots of results spewing out from the db
while ($next=fetch_array($next_query) )
if($sql['products_id'] == $next['products_id']) {
for ($i=0, $n=sizeof($next); $i<$n; $i++) {
echo "sql[number]";
else
echo <a href="product_info.php">echo "sql[number]";</a>
?>
</td>
<?php }?>
</tr>
</table>
<--end table-->