Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 29. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Calculated default values?

phpMyEdit Configuration     Calculated default values?
Odoslať novú tému   Odpovedať na tému   Choď na stránku Predchádzajúci  1, 2  
 
ScottChapman     Založený: 09.06.2007   Príspevky: 31  
Príspevok Zaslal: 2009-04-05 00:39
Návrat hore  Odpovedať s citátom     

Thanks. I know the trigger is getting called since I am seeing my trace statement print the proper value of the next membership number.

It is just that the field value is not getting set...

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-04-05 00:43
Návrat hore  Odpovedať s citátom     

i think you want to return false on success.

 
ScottChapman     Založený: 09.06.2007   Príspevky: 31  
Príspevok Zaslal: 2009-04-05 00:54
Návrat hore  Odpovedať s citátom     

Nope. That appears to prevent the insertion form from being displayed.

 
ScottChapman     Založený: 09.06.2007   Príspevky: 31  
Príspevok Zaslal: 2009-04-05 01:07
Návrat hore  Odpovedať s citátom     

I just tried to print the $nevals array, and it is empty...

 
ScottChapman     Založený: 09.06.2007   Príspevky: 31  
Príspevok Zaslal: 2009-04-05 01:19
Návrat hore  Odpovedať s citátom     

It looks like the value gets set it I use this script as a before trigger rather than a pre trigger.

But that isn't exactly what I want...

I want to be able to display the newly calculated value when the insert for is displayed, not change the value when it is submitted...

 
chris209348     Založený: 22.04.2009   Príspevky: 3  
Príspevok Zaslal: 2009-04-22 15:32
Návrat hore  Odpovedať s citátom     

I wanted to seed the default values in the add box with a pre trigger. This is what I did.

Kód:

<?php
function find_in_fdd($fdd,$num_fds,$name)
{
   for ($k = 0; $k < $num_fds; $k++) {
      if ($fdd[$k]['name']==$name) return $k;
   }
   echo '<h1>Not found! '.$name.'</h1>';
   die;
}
global $player;
$res=$this->myQuery("SELECT ifnull(max(privateid),0)+1 AS new_private_id FROM unit_tbl WHERE player=".$player);
$row=mysql_fetch_array($res);

$entry=find_in_fdd($this->fdd,$this->num_fds,'PrivateID');
$this->fdd[$entry]['default']=$row['new_private_id'];

return true;
?>


I couldn't see a neeter way to find the column "PrivateID" but this works.

 
ScottChapman     Založený: 09.06.2007   Príspevky: 31  
Príspevok Zaslal: 2009-04-22 16:27
Návrat hore  Odpovedať s citátom     

Oh I see, I can just set the default for the field in the pre trigger?

Thanks might work. Not sure why I didn't think of that...

 
Odoslať novú tému   Odpovedať na tému   Choď na stránku Predchádzajúci  1, 2  

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