944,110 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2294
  • PHP RSS
Aug 19th, 2005
0

Sending quotes to my database

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
heavychevy is offline Offline
9 posts
since Aug 2005
Aug 20th, 2005
0

Re: Sending quotes to my database

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
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
bwest is offline Offline
57 posts
since Jul 2004
Aug 22nd, 2005
0

Re: Sending quotes to my database

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
heavychevy is offline Offline
9 posts
since Aug 2005
Aug 23rd, 2005
0

Re: Sending quotes to my database

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
Reputation Points: 14
Solved Threads: 1
Junior Poster in Training
bwest is offline Offline
57 posts
since Jul 2004
Aug 24th, 2005
0

Re: Sending quotes to my database

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
heavychevy is offline Offline
9 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Urgent help needed installing!
Next Thread in PHP Forum Timeline: Memory Limitations?? with PHP affecting pdf generation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC