mysql_escape_string question

Posted by topdog 616 days ago Questions| mysql escape string escape All

Hi,

Just a quick query really, In my PHP file, I have variables coming from my HTML form, like so:

$companyName = mysql_escape_string($_POST['compName']);
$AddLine1 = mysql_escape_string($_POST['add']);
$AddLine2 = mysql_escape_string($_POST['add1']);            
$AddLine3 = mysql_escape_string($_POST['add2']);

Throughout this script, I do a few select, insert statements with mysql. What I'm wondering is, is it okay to just use the mysql_escape_string once like above, or do I need to do it every time I use the variable?

Probably a really simple (or silly) question but I said I'd ask anyway.

Originally asked by: TaraWalsh on Stack Overflow

Discuss Bury


Who Voted for this Question