aleniko Posted September 5, 2012 Share Posted September 5, 2012 Hi; What is wrong with the following syntax? $sql='SELECT acct, name, address1,address2,city,state,zip,tel '.^M 'FROM krccust left join zips on krccust.zip = zips.zip ';^M $res = mysql_query($sql);^M As opposed to $sql='SELECT acct, name, address1,address2,city,state,zip,tel '.^M 'FROM krccust ';^M $res = mysql_query($sql);^M In the first case I get an error "Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource" In the second case everything works fine. Note that I get the error when I issue the following: while($row = mysql_fetch_object($res)){ Thank you all! Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 5, 2012 Share Posted September 5, 2012 use mysql_error() to find the error. I don't see a problem, is this the actual code? Quote Link to comment Share on other sites More sharing options...
aleniko Posted September 5, 2012 Author Share Posted September 5, 2012 OK - figured it out for myself. I have to use the table name if the field names are identical. So I tried $sql='SELECT acct, name, address1,address2,krccust.city,krccust.state,krccust.zip,tel '.^M 'FROM krccust left join zips on krccust.zip = zips.zip ';^M And it worked. Still, thanks :-) Quote Link to comment 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.