I've got an insert statement where there is a memo field that can easily contain quotes or single quotes or apostrophes. I cannot get it to insert I have tried with replacing the aposatrophe with a \', doesn't like it i have also tried

if (get_magic_quotes_gpc()==1) {

        $notes = stripslashes(ereg_replace('"','"',$_POST["other_notes"])) ;

        } else {

        $notes = addslashes ( $string );


the following is the sql statement:

Insert into lead_lines(empID, leadID, date_, notes) VALUES(1,14,'8/19/2005',' 

This guy seems like a real easy going dude. Might've been high when he ordered.')

How can I make the database except this???
It's stressing me out.


Edited by pyTony: fixed formating

11 Years
Discussion Span
Last Post by heavychevy

Do you have phpMyAdmin? If so I would make an insert with that and make sure you use your single or double quotes, which ever you want. - And see how it does the job. It will make the insert and show the query that was used


I appreciate your answer. Although I have done that to test the sql statement. The thing is I need this to be able to be done on the page itself. It's an intranet system where employees can insert new customers and search for them etc.. If I can't do this on the page itself it's pointless.


So are your employees using a form that you made? I hope their not allowed to make the query theirselves.

So if your using a form, you'll just have to format the string to be exactly what the phpmyadmin gave you


I have it figured out. the answer is the following:
$squo = " ' ' ";
$specs = stripslashes(ereg_replace(" ' ", $squo, $_POST["specs"]));

p.s. no i don't have phpmyadmin, because i'm using php with an Access 200 db.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.