Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 21. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Need to get auto-increment number to display on insert page

phpMyEdit Configuration     Need to get auto-increment number to display on insert page
Odoslať novú tému   Odpovedať na tému    
 
DaaL1973     Založený: 09.12.2007   Príspevky: 7  
Príspevok Zaslal: 2008-01-03 13:34
Návrat hore  Odpovedať s citátom     

Hi guys, my table has a autonumber field which is used as the record ID (obviously) but also a reference number for the customer. What I want is to see the generated autonumber when i go to the "Add" page, at the moment all i get is a 0, which is updated to the next number only when the save button is pressed.

I would guess I need to use a trigger to save a new record then return to the add page for that record, but i dont know where to start, please be pretty specific with any solutions as i am not that good with php yet.

Cheers

 
exio82     Založený: 20.09.2007   Príspevky: 6  
Príspevok Zaslal: 2008-02-14 13:29
Návrat hore  Odpovedať s citátom     

Hi DaaL,
you can use a insert-pre trigger to add a new record and set the default value of key field, but it is dangerous.
You need also to delete that empty record if the user push 'cancel' button and what about if the user just close browser window? you get empty records in db.

best way is to show the generated number after insertion (user hit 'save' or 'save&continue' button).

Sample code follows:

Kód:

$opts['triggers']['insert']['after'] = 'show_pk.inc';


and in show_pk.inc:
Kód:

echo '<p><big>Last assigned key: '.$this->rec.'</big></p>';
return true;


 
genio     Založený: 15.09.2008   Príspevky: 2  
Príspevok Zaslal: 2008-09-15 17:04
Návrat hore  Odpovedať s citátom     

No need, look at my post in this link;

http://opensource.platon.sk/forum/projects/viewtopic.php?p=117095#117095

I think its what you are looking for with the changelog feature...

 
DaaL1973     Založený: 09.12.2007   Príspevky: 7  
Príspevok Zaslal: 2008-09-16 14:35
Návrat hore  Odpovedať s citátom     

Hi Genio

looks like that should work, could you be a bit more specific about how to implement this please - i'm a bit thick!

genio Napísal:
No need, look at my post in this link;

http://opensource.platon.sk/forum/projects/viewtopic.php?p=117095#117095

I think its what you are looking for with the changelog feature...


 
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