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