Jump to content

MySql Update Run Once only


four4swords

Recommended Posts

hi,

 

I have this problem here.. Where i want to update some info .. but only for ONE record..

 

Let's say i have a table like this..

 

Item    |  Type  | Stock

Apple  | Food    | 1

Orange | Food    | 1

Cat      |Animal  | 1

Apple  | Food    | 1

Orange | Food    | 1

Cat      |Animal  | 1

 

And I want just one row with the item CAT to decrease it's stock to zero..

 

mysql_query("UPDATE itemsSET Stock = '0' WHERE Type = 'Animal   '") or die(mysql_error());

 

That bit of code there.. will change ALL my "ANIMAL" types to a stock of ZERO..

 

What can i do so that only ONE row is changed to ZERO?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/92398-mysql-update-run-once-only/
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.