| Index
» Projects
» phpMyEdit
» Forum
» Create custom-nbr with pre-insert-trigger |
 |
BlueLord
Joined: 10 Dec 2005
Posts: 2
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
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
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
|
|
|
|