I am a new php "developer" and a new member of the SOF site. I am launching a website for the first time and in my online research I have been told that while PHP might be easy at the surface the most important thing that developers overlook is injections.
As SOF states that you should research before you ask a question here, i did and it seems that mysql_real_escape_string(); is required to escape characters that could harm the database. THen I also found that you have prepared statements. However, doing searches on both SOF and Google, I found that it matters less which of the two you use because either way user-inputed data is being used to query/insert into the db.
So I am now really confused because i have found more people championing for escape_string statements and a few for Prepared statements.
This is what I am doing:
For Post variables:
$thething = mysql_real_escape_string($_POST['field']);
For Get variables:
$thething = mysql_real_escape_string($_GET['id']);
For Request variables:
$thething = mysql_real_escape_string($_REQUEST['id']);
Please do let me know what you guys think.