mysqli_real_escape_string

I have been searching for a way to insert quotes in a database. I found that I could use mysqli_real_escape_string but it does not work. I cannot even echo it. What is wrong?

[embed=425,349]$title = “People’s Choice”;
$title1 = mysqli_real_escape_string($title); // it does not work

echo $title1;

mysqli_query($con,“INSERT INTO myTable
(title)
VALUES (’$title1’)”);[/embed]

You need to add the $con as the first argument in the function, just like all other mysqli functions (at least when using the procedural methods). You won’t necessarily see the escaping of the quotes by echoing the var I don’t think.

Yes, that was the point. Thank you

Sponsor our Newsletter | Privacy Policy | Terms of Service