I'm fairly new to PHP but have been familiar with StackOverflow for a while.
I have recently been reading about appropriate times to use mysql_real_escape_string and would appreciate any advice on the following.
Is using mysql_real_escape_string once, on the initial $_POST variable enough to secure the string through the script?
For example:
$username = mysql_real_escape_string($_POST["username"]);
$password = mysql_real_escape_string($_POST["password"]);
$email = mysql_real_escape_string($_POST["email"]);
$repeat_password = mysql_real_escape_string($_POST["repeat_password"]);
I declare these values before running a bunch of if statements and finally once the if statements are finished I make an INSERT into the mysql database:
mysql_query("INSERT INTO users (username, password, email, signup_date) VALUES ('$username', '$password', '$email', CURDATE())") or die(mysql_error());
mysql_real_escape_string is not used anywhere else throughout the if statements - is this safe enough for a rookie to use whilst still maintaining some injection protection?