•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 402,624 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,181 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 2138 | Replies: 5 | Solved
![]() |
•
•
Join Date: Mar 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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.
[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.
•
•
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation:
Rep Power: 6
Solved Threads: 5
I edited code for easier reading.
•
•
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation:
Rep Power: 6
Solved Threads: 5
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
$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
•
•
Join Date: Mar 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
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.
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- test mysql query for no results (PHP)
- FILTER QUERY results on a FORM? (Visual Basic 4 / 5 / 6)
- Querying within the results of a previous query? (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: MySQL client - please help
- Next Thread: query problem


Linear Mode