mrscripto
Založený: 03.04.2004
Príspevky: 10
Zaslal: 2004-04-04 23:38
Návrat hore
Odpovedať s citátom
|
I have a table called articles with columns: id, name, and status. I want to make it so only one article can have status set to 1 (open). I know how to do it using php and mySQL, but am wondering if there is a way to accomplish it with phpmyedit, as I'm using this script on other tables in my database, and want to stay consistent.
For example... I have 4 records in my table articles, but only one can be the current active article, so the status on one is set to 1, with the others at 0. So if I set another article's status to 1, I either want the script to tell the user that there is another article open, or to change the current open one to closed. :)
please help
regards,
MrScripto
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2004-04-05 21:03
Návrat hore
Odpovedať s citátom
|
look for trigger update before.
using a standard sql/php coding and $newvals array you can check whther change is legal and halt it if not.
see docs for more details and forum for triggers examples.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|