This topic is locked

where is my error

8/14/2009 7:10:16 AM
PHPRunner General questions
S
sickacid author

in afteradd, if $i > $p the cicle don't work, where is the error???
global $conn;

$esc = 0;

$i = $values["KmFine"];

$id = $values["IdTarga"];

$str = "select SogliaTagliando from anagraficaautomezzi where Id=".$id;

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

$p = $data["SogliaTagliando"];
do {

if ($i < $p)

{
$strSQLInsert = "insert into scadenziario (IdTarga, TipoScadenza, note, ProssimoTagliando, ScadenzaGestita) values ('".db_addslashes($values["IdTarga"])."', 'TAGLIANDO', $i, $p,0)";

db_exec($strSQLInsert,$conn);

$esc = 1;

}
else

{

//$esc = 0;

$p = $p+$p;

}

}
while ($esc = 0);

A
alang 8/16/2009

Suggest you ensure all values in your SQL statements surrounded by single quotes:
$str = "select SogliaTagliando from anagraficaautomezzi where Id='".$id."'";
and
'TAGLIANDO', '$i','$p','0')";
and watch the equality test:
while ($esc == 0);