Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, October 14, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Create custom-nbr with pre-insert-trigger

phpMyEdit General     Create custom-nbr with pre-insert-trigger
Post new topic   Reply to topic    
 
BlueLord     Joined: 10 Dec 2005   Posts: 2  
Post Posted: 2005-12-10 17:25
Back to top  Reply with quote     

Hi,

My system is Linux.
phpMyEdit is 5.4

My Problem:
When i click 'insert' i will a new custom-nbr automaticly create and set it in the custom-nbr-field. With an echo i see the new custom-nbr is correct. The inserted record has every time an empty custom-nbr-field!.

Here is my code:
...

$opts['triggers']['insert']['before'] = 'ed_kunde_neu.TIP.inc';

//$opts['triggers']['insert']['pre'] = 'ed_kunde_neu.TIP.inc';
//$opts['triggers']['insert']['after'] = 'ed_kunde_neu.TIP.inc';

...

trigger-file ed_kunde_neu.TIP.inc is:

$sql = "SELECT MAX(kunde_nr) AS kunde_nr FROM kunde";
if($result = mysql_query($sql))
{
while($row = mysql_fetch_array($result))
{
$kx = $row[kunde_nr] + 1;
echo "kunde_nr=$kx<br>";

$newvals["kunde_nr"] = $kx;
$this->rec = $newvals["kunde_nr"];
}
}
return true;

How can i do this correctly?

Best Regards
Blue Lord

 
ajh     Joined: 17 Dec 2003   Posts: 236  
Post Posted: 2005-12-12 14:31
Back to top  Reply with quote     

I have no idea whether this is true, but have you tried converting your new number to a string before you put it in the array in the trigger? As you have it at present, it will be set as an integer.

 
BlueLord     Joined: 10 Dec 2005   Posts: 2  
Post Posted: 2005-12-12 15:48
Back to top  Reply with quote     

@ajh
thx for your tip.

I have tried it. It gives the same result - no value is set in the inserted record.
Every manual input is saved.

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy