scotch33 Posted January 22, 2009 Share Posted January 22, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/141952-seemingly-fine-sql-query-driving-me-madhelp/ Share on other sites More sharing options...
MachineHead933 Posted January 23, 2009 Share Posted January 23, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/141952-seemingly-fine-sql-query-driving-me-madhelp/#findComment-743995 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.