I have the following code, within a larger php script:
$FullSQL = $inSQL;
foreach($ROW as $item) {
$ItemName = (string)$item->getName();
$fieldValue = $ROW->$ItemName;
$FullSQL = $FullSQL . "'" . mysql_real_escape_string($fieldValue) . "', ";
}
$inSQL_len = strlen($FullSQL) -2;
$FullSQL=substr($FullSQL, 0, $inSQL_len ) . ")";
echo "INSERTED FullSQL=" . $FullSQL . "<br><br>";
if (!mysqli_query($con,$FullSQL)) { die('Error insering tmporder: ' . $FullSQL . " ERROR:" . mysqli_error()); }
else {
echo "INSERTED inSQL=" . $FullSQL . "<br><br>";
}
}
}
I've managed to convert the whole script to mysqli, except that above section. As expected, the mysql_real_escape_string($fieldValue)
part is generating a mysql depreciation error.
How to I convert that piece of code to use mysqli? It requires two variables, and there is only one.
Thanks.