PHP updating mysql issue

Soldato
Joined
18 Oct 2002
Posts
7,644
Location
Sutton Coldfield, Birmingham
If I am using the following php to update the table:-

PHP:
$q = "UPDATE results SET hello = '$_POST[hello]' WHERE id = '1'";

and if $_POST[hello] equals:-

PHP:
hello i'm a cool dude

it would create an error as follows:-

PHP:
$q = "UPDATE results SET hello = 'hello i'm a cool dude' WHERE id = '1'";

You can see there are too many ' in that query, how would I go about making the query work even if the ' is still there?
 
Back
Top Bottom