954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Sending quotes to my database

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.

Thanks

heavychevy
Newbie Poster
9 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

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

bwest
Junior Poster in Training
57 posts since Jul 2004
Reputation Points: 14
Solved Threads: 1
 

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.

heavychevy
Newbie Poster
9 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

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

bwest
Junior Poster in Training
57 posts since Jul 2004
Reputation Points: 14
Solved Threads: 1
 

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.

heavychevy
Newbie Poster
9 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You