Jump to content

Need URGENT Help with query


reservoir

Recommended Posts

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-->

Link to comment
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.