## Apostrophe causing problems in insert to database

I have a particular field in a form that has an apostrphe in the title and when inserting into the database, I get the error relating to the apostrophe

So I tried the code below, and its not working, could somebody take a look please.

Code:
`\$sql = mysql_query("INSERT INTO hazzard (name_db, project_db, company_db, contact_db, detail_db, Location_1, Location_2, Location_3) VALUES ('{\$_SESSION['name_A']}','{\$_SESSION['projects_A']}','{\$_SESSION['companies_A']}','{\$_SESSION['numbers_A']}','\$detail','".mysql_real_escape_string{\$_SESSION['top_A']}."','{\$_SESSION['middle_A']}','{\$_SESSION['bottom_A']}')") or die (mysql_error());`
Its where I am attempting to use mysql_real_escape_string