Hi all,
when I read a table, edit a value and want to write that back to the table in another field, there goes something wrong when the selected field contains \"123456789AB\". However \"123456\" goes alright.
$data_res = db_query("SELECT number, number2 FROM item") or db_die();
while ($data_row = db_fetch_row($data_res)) {
$string2 = $data_row[0];
$string2 = str_replace(".", "", $string2);
$result=db_query("update item set number2=$string2 where number=$data_row[0]") or db_die();
if ($result) {echo "Article $data_row[0] with new $string2 is updated";}
else {echo "-- > Article $data_row[0] with new $string2 is not updated";}
echo "<BR>";
}
I fetch the value \"1234.5678AA\", this result in $string2 as \"12345678AA\" but MySql gives an error \"There is something wring in the used syntax at \'AA\' in row 1\". :?
When I fetch a value of \"1234.5678\", $string2 will result with \"12345678\" and the update goes fine.
The details of \'number2\' field is text.
Please HELP!!!!
thanks,
Henk.