# Escaping apostrophe to mysql

**URL:** https://forum.kirupa.com/t/escaping-apostrophe-to-mysql/242837
**Category:** Uncategorized
**Created:** [October 30, 2007, 9:21pm UTC](https://forum.kirupa.com/t/escaping-apostrophe-to-mysql/242837 "2007-10-30T21:21:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jacob](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jacob](https://forum.kirupa.com/u/jacob)
#### Post date: [October 30, 2007, 9:21pm UTC](https://forum.kirupa.com/t/escaping-apostrophe-to-mysql/242837/1 "2007-10-30T21:21:14Z")

</div>

i have a delete.php script, which successfully deletes rows from a mysql DB.

i am having trouble getting it to properly escape the ’ from a name, which is needed, because the delete is using the exact name to locate the item

//------------------------ begin  
$project=$\_GET[‘chosen’];

include(‘header.inc’);  
include(‘inc.config.php’);

mysql\_connect($dbhost, $dbuser, $dbpasswd);  
@mysql\_select\_db($dbname) or die( “Unable to select database”);  
$query=“DELETE FROM `menu_table` WHERE menuname=’$project’”;

mysql\_query($query);  
mysql\_close();  
echo “Project Deleted”;  
?\>  
////------------------------ end

I know i need to use str\_replace or something like that, and we are using it elsewhere. but in this case, its just not working right.

can someone correct this for me?
