Jump to content

PHP/Mysql question


Gruzin

Recommended Posts

I think what your asking to do is swap the position two records are stored in the actual database, what you will have to do is extract the values of each field from both the records and then update each record with the other records values, excluding the primary key field.  This will then have the effect of swapping them around, I think!
Link to comment
https://forums.phpfreaks.com/topic/26952-phpmysql-question/#findComment-123248
Share on other sites

[quote author=chiprivers link=topic=114659.msg466593#msg466593 date=1163276806]
I think what your asking to do is swap the position two records are stored in the actual database, what you will have to do is extract the values of each field from both the records and then update each record with the other records values, excluding the primary key field.  This will then have the effect of swapping them around, I think!
[/quote]
That's what i thought, thanks freind  ;)
Link to comment
https://forums.phpfreaks.com/topic/26952-phpmysql-question/#findComment-123251
Share on other sites

well i might be wrong .. but you could always set up and id field w/ auto increment and then set up the code to change the # of the id field from say 5 to 2 but then you would have to change the id field of 2 to 5 .. im sure it would be hard to setup .. but you might be able to create some type of counter that would decrease and increase the field number at the same time .. that kind of thing .. but i could be wrong .. :] but as chiprivers said you might not be able to do it with the primary key ...
Link to comment
https://forums.phpfreaks.com/topic/26952-phpmysql-question/#findComment-123262
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.