Sending quotes to my database

Reply

Join Date: Aug 2005
Posts: 9
Reputation: heavychevy is an unknown quantity at this point 
Solved Threads: 0
heavychevy heavychevy is offline Offline
Newbie Poster

Sending quotes to my database

 
0
  #1
Aug 19th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 57
Reputation: bwest is an unknown quantity at this point 
Solved Threads: 1
bwest's Avatar
bwest bwest is offline Offline
Junior Poster in Training

Re: Sending quotes to my database

 
0
  #2
Aug 20th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 9
Reputation: heavychevy is an unknown quantity at this point 
Solved Threads: 0
heavychevy heavychevy is offline Offline
Newbie Poster

Re: Sending quotes to my database

 
0
  #3
Aug 22nd, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 57
Reputation: bwest is an unknown quantity at this point 
Solved Threads: 1
bwest's Avatar
bwest bwest is offline Offline
Junior Poster in Training

Re: Sending quotes to my database

 
0
  #4
Aug 23rd, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 9
Reputation: heavychevy is an unknown quantity at this point 
Solved Threads: 0
heavychevy heavychevy is offline Offline
Newbie Poster

Re: Sending quotes to my database

 
0
  #5
Aug 24th, 2005
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC