Possible Duplicate:
Best way to prevent SQL injection in PHP?
I have seen mysql_real_escape_string and strip slashes being used in preventing MySQL injections. Or would I need more and place this all into function, then use the function to prevent injection?
$query = ("SELECT * FROM `users` WHERE `fname` REGEXP '%s' AND `lname` REGEXP '%s' LIMIT
%d",
mysql_real_escape_string($fname),
mysql_real_escape_string($lname),
(int)$RowsLimit);
Or would it be better to do something like this? mysql_real_escape_string(stripslahses($fname)),