Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 30. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Adding from copy button using auto increment

phpMyEdit Configuration     Adding from copy button using auto increment
Odoslať novú tému   Odpovedať na tému    
 
rimmo69     Založený: 08.07.2008   Príspevky: 9  
Príspevok Zaslal: 2008-08-08 18:40
Návrat hore  Odpovedať s citátom     

I'd like to be able copy posts when adding new items and have the ID automatically filled out with the next highest ID number.

I managed to get the next highest ID when just clicking on the add button, by using

Kód:
mysql_connect("localhost", "*******", "*******") or die(mysql_error());
mysql_select_db("rimmo_dk") or die(mysql_error());
$data = mysql_query("SELECT MAX(Inventar) AS id FROM medico");
$row = mysql_fetch_array($data);

$newinventar=$row[id]+1;


Then the default value is set to $newinventar....
But is there any way to override one field when copying.... This would be a great help for me and my colleges.

Fingers crossed.

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2008-09-08 12:59
Návrat hore  Odpovedať s citátom     

alter $newvals in before trigger.

database connection is not needed in trigger, you should use $this->dbh as database connection handler.

 
rimmo69     Založený: 08.07.2008   Príspevky: 9  
Príspevok Zaslal: 2008-09-08 18:06
Návrat hore  Odpovedať s citátom     

Thanks for the response... I am still trying to figure this out.... I'm gonna experiment with what you have given me.

I'll need to read up on triggers first though.
Cheers Graham

 
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