This topic is locked
[SOLVED]

 How can I a variable ?

11/22/2020 3:45:20 AM
PHPRunner General questions
J
Jan author

in the event "after record added" i use this code :
$code = $values["code"];

$sql = "delete from nummers where code = $code";

DB::Exec( $sql );
When the variabele $code is filled with a number ( for example 12345 ) its works fine !
But when the variable $code is filled with a asci code ( for example A2345 ) its not work !
What am I doing wrong ?

A
acpan 11/22/2020

Because you need to quote your data, since you also want to insert string 'A12345' not just numbers 12345:
Try this:
$sql = "delete from nummers where code = '$code' ";

J
Jan author 11/23/2020

Great ! works fine
thanks