Solved

how do I get rid of an apostrophe with php?

Posted on 2011-02-15
2
327 Views
Last Modified: 2012-05-11
I have a php query and it's submitting the info to the database the problem is is if there is an apostrophe in the information that the client submits it messes up the query. Is there a way to strip out the apostrophe from the query?
0
Comment
Question by:anotherdotcommer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 9

Accepted Solution

by:
AriMc earned 500 total points
ID: 34901010
It depends on your database engine. If you're using MySQL then you could use mysql_real_escape_string function:

http://www.php.net/manual/en/function.mysql-real-escape-string.php

0
 
LVL 9

Expert Comment

by:AriMc
ID: 34901068
And for PostgreSQL, use  pg_escape_string:

http://www.php.net/manual/en/function.pg-escape-string.php

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question