Jump to content


Photo

Update table


  • Please log in to reply
3 replies to this topic

#1 Bee

Bee
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 02 March 2006 - 11:39 AM

Hi,

I am getting mad here! I don't know why this stuff just don't work.

I am trying to update this table. When I set the condition to UserID which is the primary key, it does not change it and it returns this message even if I supply an existing UserID:
Query OK, 0 rows affected
Rows matched: 0 Changed: 0 Warnings: 0


If The condition was something else like Surname, Email...etc, it works fine.

The primay key (UserID) is auto_increment!

mysql> UPDATE PersonalDetails SET Initials="Miss", Surname="Something", Forename="Maja", Address="01 Co", PostCode="212", TelHome="21", TelMobile="121", Email="person@hotmail.com" WHERE UserID=14;

Thanks very much in advance.

Bee


#2 nezbie

nezbie
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationFINLAND

Posted 02 March 2006 - 12:04 PM

[!--quoteo(post=350920:date=Mar 2 2006, 06:39 AM:name=Bee)--][div class=\'quotetop\']QUOTE(Bee @ Mar 2 2006, 06:39 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hi,

I am getting mad here! I don't know why this stuff just don't work.

I am trying to update this table. When I set the condition to UserID which is the primary key, it does not change it and it returns this message even if I supply an existing UserID:
Query OK, 0 rows affected
Rows matched: 0 Changed: 0 Warnings: 0
If The condition was something else like Surname, Email...etc, it works fine.

The primay key (UserID) is auto_increment!

mysql> UPDATE PersonalDetails SET Initials="Miss", Surname="Something", Forename="Maja", Address="01 Co", PostCode="212", TelHome="21", TelMobile="121", Email="person@hotmail.com" WHERE UserID=14;

Thanks very much in advance.

Bee
[/quote]

And this UserID with "14" exists =) ?

:: Be patient with me, I\'m new to PHP and MySQL :: :)

#3 Bee

Bee
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 02 March 2006 - 12:11 PM

[!--quoteo(post=350923:date=Mar 2 2006, 07:04 AM:name=nezbie)--][div class=\'quotetop\']QUOTE(nezbie @ Mar 2 2006, 07:04 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
And this UserID with "14" exists =) ?
[/quote]


Yes, it does!

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 02 March 2006 - 03:24 PM

UPDATE won't, well, "update" if that information is already present in the table.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users