I have the following:
$did=$_GET['deptID'];
variable passed from 1st page and on 2nd page, the link is like and to get data MySQL query is:
$q= mysql_query("select DepName from dep where DepID='$did'")or die(mysql_error());
Now my question is how can I use the mysql_escape_string() function in this query?
mysql_queryinterface. It’s so awful and dangerous that it was removed in PHP 7. A replacement like PDO is not hard to learn and a guide like PHP The Right Way explains best practices. Your user data is not properly escaped and there are SQL injection bugs and can be exploited.mysqliand any version of PHP5 from the last fifteen years supports PDO.