Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 24. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  one record in column set to active?

phpMyEdit Configuration     one record in column set to active?
Odoslať novú tému   Odpovedať na tému    
 
mrscripto     Založený: 03.04.2004   Príspevky: 10  
Príspevok 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
Príspevok 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    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov