Jump to content

[SOLVED] UPDATE two rows with two WHERE statements


gamefreak13

Recommended Posts

This is just ridiculous. This is sooooo simple and I can't figure it out. And yes "name" and "uname" are different.

 

UPDATE mytable SET name='John', ip='68.10.721.209' WHERE uname='test' AND ip='68.10.721.209'

 

My table (before running this query) contains

 

user 68.11.21.2 Travis

test 68.11.21.2 Jason

test 68.10.721.209 Steve

user 68.10.721.209 Mike

 

My table (after running this query) contains

 

user 68.11.21.2 Travis

test 68.10.721.209 John

test 68.10.721.209 John

user 68.10.721.209 Mike

 

My query is only respecting the "where uname = test" part. It doesn't care about the ip even though I told it to only update for that ip.

Link to comment
Share on other sites

Thanks but it seems my error was I was missing a single quote ( the ' thing ) at the end. When I copied it in to the post I had copied it from a different text file which was correct, but when I copied it in to my script I missed the last single quote.

 

Don't ya just hate it when the stupid little things drive you nuts?

 

But while we have this thread.. are "AND" and "&&" the same thing?

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.