Cless Posted March 26, 2009 Share Posted March 26, 2009 I have some code similar to: mysql_query("UPDATE table SET slot='1' WHERE slot='2'"); mysql_query("UPDATE table SET slot='2' WHERE slot='1'"); Which, in the end, just does nothing, because it makes the slot be one, then sets it back to two... which isn't what I want to do. I guess it is pretty difficult to explain... Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/151297-update-issue/ Share on other sites More sharing options...
Stephen68 Posted March 26, 2009 Share Posted March 26, 2009 Well that is what you are telling it to do, I don't understand the question? Link to comment https://forums.phpfreaks.com/topic/151297-update-issue/#findComment-794753 Share on other sites More sharing options...
Cless Posted March 26, 2009 Author Share Posted March 26, 2009 Ok, let's say I have two rows in a table called "table": name|slot hi |1 moo |2 I want "hi" to take moo's slot, and "moo" to take hi's slot without having to say "WHERE name='hi'" or something similar. Link to comment https://forums.phpfreaks.com/topic/151297-update-issue/#findComment-794758 Share on other sites More sharing options...
Stephen68 Posted March 26, 2009 Share Posted March 26, 2009 Interesting but I have no idea what you mean? You want moo's slot value to take the value of hi's slot value? I guess you could make a third field and make it a primary key and then do you where clause on that? Other then that I'm not sure Link to comment https://forums.phpfreaks.com/topic/151297-update-issue/#findComment-794763 Share on other sites More sharing options...
Cless Posted March 26, 2009 Author Share Posted March 26, 2009 "hi" has the slot value of 1, and "moo" has the slot value of 2, originally. I want to change to slot value of "hi" to 2 and "moo" to 1. Link to comment https://forums.phpfreaks.com/topic/151297-update-issue/#findComment-794765 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.