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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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