Given the following query (in the code, NOT a stored procedure); how can I add parameters to the query rather than including the condition values directly in the query? In other words: how can I make this database call secure?
$dbhandle = mssql_connect($myServer, $myUser, $myPass);
$selected = mssql_select_db($myDB, $dbhandle);
$query = "SELECT lastname, firstname, address, phone, email ";
$query .= " FROM person";
$query .= " WHERE lastname LIKE '" . $lastName . "'";
$result = mssql_query($query);
while($row = mssql_fetch_array($result)) {
... etc.
LIKEwithout % you may as well use =