| Index
» Projekty
» phpMyEdit
» Fórum
» Create custom-nbr with pre-insert-trigger |
 |
BlueLord
Založený: 10.12.2005
Príspevky: 2
Zaslal: 2005-12-10 17:25
Návrat hore
Odpovedať s citátom
|
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
Založený: 17.12.2003
Príspevky: 236
Zaslal: 2005-12-12 14:31
Návrat hore
Odpovedať s citátom
|
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
Založený: 10.12.2005
Príspevky: 2
Zaslal: 2005-12-12 15:48
Návrat hore
Odpovedať s citátom
|
@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.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|