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! Link to comment https://forums.phpfreaks.com/topic/268023-begginer-halp/ 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? Link to comment https://forums.phpfreaks.com/topic/268023-begginer-halp/#findComment-1375467 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 :-) Link to comment https://forums.phpfreaks.com/topic/268023-begginer-halp/#findComment-1375474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.