This topic is locked

Help! Unexpected behavior of the event code

8/31/2008 3:13:39 PM
PHPRunner General questions
V
vytb author

When I wrote the code below for the before-record=added/updated events, the first added value of the "Nb_s" (btw, it's 7), is being saved for all the subsequent records as if it was default value. The original value is overwritten. What's the hell it should mean?
When I clear the event, everything returns to the normal... If I put the code, all the "Nb_s" values after saving become 7.
if ($values["Nb_s"]=3 or $values["Nb_s"]=4)

$values["Nb_s_LI"]=1;
if ($values["Nb_stools"]=5 or $values["Nb_s"]=6)

$values["Nb_s_LI"]=2;
if ($values["Nb_stools"]=7 or $values["Nb_s"]=8 or $values["Nb_s"]=9)

$values["Nb_s_LI"]=3;
if ($values["Nb_s"]>=10)

$values["Nb_s_LI"]=4;
else

$values["Nb_s_LI"]=0;
return true;

A
alang 8/31/2008

See my answer to your last post http://www.asprunner.com/forums/index.php?showtopic=9381
In PHP the test for equality is "==" and the assignment operator is "=" even though in English we use the same word "equals" in both cases - a bit confusing for sure.

V
vytb author 9/1/2008

Thanks Alan a lot,
that's it! - It works!