how can I prevent from sql injection I saw a tutorial where the hacker can check if the website was easy to hack by just adding ' to the url and if it was it would display the error and the line where the error was at. this is my sql
$sql = "SELECT * FROM sell_table WHERE 1=1";
if ($names)
$sql .= " AND names='" . mysql_real_escape_string($names) . "'";
if ($prices)
$sql .= " AND prices='" . mysql_real_escape_string($prices) . "'";
this is a line that make a name in to a link
$strLink = "<a href = 'person.php?ids=".$row['id']."'>" .$strName. "</a>";
how can I prevent this from sql injection