I have the following code:

$rebate_query = tep_db_query("select * from " . TABLE_REBATES . " where product_id = " . (int)$HTTP_GET_VARS['products_id']);
    $rebate_information = tep_db_fetch_array($rebate_query);

This should return only 1 row of data

I have this code - "

$rebate = $rebate_information['rebate_amount'];

"
for extracting the rebate amount. For the life of me I cannot
understand why this isn't working. It doesn't error out, but nothing is returned, and I know that the value exists.

I would very much appreciate any help you can give. Thanks.

Re: Extracting Results from Query 80 80

I edited code for easier reading.

Re: Extracting Results from Query 80 80

Use this code instead:

$rebate = mysql_fetch_array($rebate_information['rebate_amount']); 
$rebate = $rebate[0];

And now, $rebate is set :)

Let me know if it didn't work; my PHP is a bit on the rough side during March Break :p

Re: Extracting Results from Query 80 80

Use this code instead:

$rebate = mysql_fetch_array($rebate_information['rebate_amount']); 
$rebate = $rebate[0];

And now, $rebate is set :)

Let me know if it didn't work; my PHP is a bit on the rough side during March Break :p

Hi Gary. Thanks for the response. I am getting the following error when I try your suggestion:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource.

I tried using the oscommerce fetch array function in its place, and that didn't work either. I am stumped on this for some reason. Logically, it doesn't make much sense to me yet.

If you could take another look I'd appreciate it.

Thanks again.

Re: Extracting Results from Query 80 80

Thanks for your help. I had a different problem which was causing
my grief - got everything working now......

Re: Extracting Results from Query 80 80

Glad it worked :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.