Jump to content

Begginer halp


aleniko

Recommended Posts

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

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

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.