5
Here’s what I’m doing INSERT
:
$result = mysql_query("INSERT INTO tbl_livro VALUES (NULL, '$titulo', '$autor_livro')");
What happens is that there are authors who have names with special characters, for example: O'Reilly Media, Inc.
What happens is that the '
makes conflict in insertion.
Is there any way to ignore the special characters inside the variable $autor_livro
? The goal is to insert with the special characters.
Note: I know I should use mysqli
or PDO
but in this example it has to be even in mysql
.
AP already made the reservation in the question.
– Jorge B.
@Jorgeb. I’ll include an extra example of how Prepared statements can help our life if someone sees the question in the future.
– gmsantos
but my goal is to insert with the special characters, the mysql_real_escape_string allows this?
– pc_oc
@pc_oc yes, that’s exactly what this function does.
– gmsantos
thanks @gmsantos. Unfortunately in this project I have to use mysql and not PDO. thanks
– pc_oc