This topic is locked

Check and change before updating

1/14/2009 5:16:10 AM
PHPRunner General questions
T
taumic author

Hallo,

I have a database (Artikel) with 3 fields: Preis_EUR , Price_USD and EUR_Faktor.
Before updating I want to check, is the field EUR_Faktor filled, and if so

I want to calculate the price in EUR.
So I do following:

In EditPage / Before Record updated I put this code:
[codebox]if ($values["EUR_Faktor"] <> 0 )

{

$values["Preis_EUR"]=$values["Price_USD"] * $values["EUR_Faktor"] } ;
return true;[/codebox]
But I get an error: "Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in D:\Server\WWWROOT\Alaska\include\artikel_events.php on line 30"

What is my mistake ?

J
Jane 1/14/2009

Hi,
you've missed semicolon.

Please see my changes below:

if ($values["EUR_Faktor"])

$values["Preis_EUR"]=$values["Price_USD"] * $values["EUR_Faktor"];
return true;

T
taumic author 1/14/2009

Hallo Jane,
thank`s a lot - now it is running perfect .....
taumic