How do I correctly write the code for a MySQL query that both implodes and mysql_real_escape_string?
This is the code that I have, but it's failing:
$sql = "INSERT INTO BEER_LOCATIONS
(LOCATION_NAME, LOCATION_STREET, LOCATION_CITY, LOCATION_STATE,
LOCATION_ZIPCODE, LOCATION_PHONE, BEER_STYLE )
VALUES
('" . mysql_real_escape_string(implode("', '", $row)) . "')";
Thanks
implode("', '", array_map('mysql_real_escape_string', $row))
This applies mysql_real_escape_string to every element in $row and returns an array with the escaped values to implode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With