Can I use mysql_real_escape_string together with strip_tags?

2.5k Views Asked by At

Sorry if this is a silly question, but I currently have the following and it SEEMS to be working in the browser, but Dreamweaver is telling me there is a syntax error:

$formdescription = mysql_real_escape_string(strip_tags($_POST['form_description']));
2

There are 2 best solutions below

1
On BEST ANSWER

Yes, it's ok :) Forget Dreamweaver!

You can also split the above:

$formdescription = $_POST['form_description'];
$formdescription = strip_tags($formdescription);
$formdescription = mysql_real_escape_string($formdescription);
1
On
string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier = NULL ] )

operation of this function depends on the encoding of the current mysql connection, you must pass the second parameter [, resource $link_identifier = NULL ] to avoid warnings in DW.