Jump to content

seemingly fine sql query driving me mad!!!help.


scotch33

Recommended Posts

hi there,

 

here is my query -

$affiliateresult = ("SELECT nov_main_firstname, nov_main_surname, nov_main_coname, nov_main_id, nov_affiliate_code FROM nov_affiliate_code, nov_main_account WHERE nov_affiliate_code.nov_affiliate_id = nov_main_account.nov_main_id");

and then on line X i have the following -

while ($affiliaterow = mysql_fetch_array($affiliateresult)) { some code }

 

I have been into phpmyadmin and tested the sql in the query window and it resuklts in what i want, but when it is in my own code as above it is giving me the following

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/novusta1/public_html/admin_affiliates.php on line X

 

I have been staring at this for an hour now and cannot work out what I am doing wrong - if anyone can help I would be very grateful.

 

Thanks!

As your code stands now, you are setting "$affiliateresult" as the literal string that follows, which is just the text of the MySQL query.  If you want the results of that query to be stored as an array in that variable you should use this:

 

$affiliateresult=mysql_query(your_query_goes_here)

 

You should then be able to do what you need to with the result set later on on Line X

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.