| | |
Extracting Results from Query
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2005
Posts: 4
Reputation:
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.
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:
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
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.
![]() |
Similar Threads
- HOWTO: Run a Query on a Database using ODBC and return all Results into a DGV Object (C#)
- 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
| Thread Tools | Search this Thread |
Tag cloud for MySQL
1 agplv3 alfresco api artisticlicense aws bizspark breathalyzer camparingtocolumns cmg communityjournalism contentmanagement contractors copyright count court data database design developer development distinct drupal dui ec2 email enter enterprise error eudora facebook form foss gnu government gpl greenit groklaw hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire law legal license licensing maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php query referencedesign reorderingcolumns resultset saas search select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency update virtualization





