Hi,
I'm inserting an array with strings elements into mysql. For example :
$sql = "INSERT INTO table (field_name)
VALUES ('$array['element']')";
However, this produces a parse error because of the single quotes around the name of the element. I'm not able to escape the quotes and I don't want to use integer elements. I also would rather not concatinate the string, like:
$sql = "INSERT INTO table (field_name) VALUES ('" . $array["element"] . "')";
Is there another way to solve this? I haven't tested the second method yet, so I'm not even sure that would work. Any ideas? Thanks so much.
I'm inserting an array with strings elements into mysql. For example :
$sql = "INSERT INTO table (field_name)
VALUES ('$array['element']')";
However, this produces a parse error because of the single quotes around the name of the element. I'm not able to escape the quotes and I don't want to use integer elements. I also would rather not concatinate the string, like:
$sql = "INSERT INTO table (field_name) VALUES ('" . $array["element"] . "')";
Is there another way to solve this? I haven't tested the second method yet, so I'm not even sure that would work. Any ideas? Thanks so much.