944,196 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Marked Solved
  • Views: 2834
  • MySQL RSS
Mar 21st, 2005
0

Extracting Results from Query

Expand Post »
I have the following code:

[php]$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);[/php]

This should return only 1 row of data

I have this code - " [php]$rebate = $rebate_information['rebate_amount'];[/php] "
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Ajaxxx is offline Offline
4 posts
since Mar 2005
Mar 22nd, 2005
0

Re: Extracting Results from Query

I edited code for easier reading.
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
Mar 22nd, 2005
0

Re: Extracting Results from Query

Use this code instead: [php] $rebate = mysql_fetch_array($rebate_information['rebate_amount']);
$rebate = $rebate[0];[/php]

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
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
Mar 22nd, 2005
0

Re: Extracting Results from Query

Quote originally posted by Gary ...
Use this code instead: [php] $rebate = mysql_fetch_array($rebate_information['rebate_amount']);
$rebate = $rebate[0];[/php]

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Ajaxxx is offline Offline
4 posts
since Mar 2005
Mar 23rd, 2005
0

Re: Extracting Results from Query

Thanks for your help. I had a different problem which was causing
my grief - got everything working now......
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Ajaxxx is offline Offline
4 posts
since Mar 2005
Mar 26th, 2005
0

Re: Extracting Results from Query

Glad it worked
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: MySQL client - please help
Next Thread in MySQL Forum Timeline: query problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC