After reading the sticky posts in this forum about security, I'd like to know if the following would be a secure way to get information from a database:
Code: Select all
function getCompanionInfo($id,&$returnArray){
global $dbConnection;
if(is_integer($id)){
$query = sprintf("SELECT * FROM companions WHERE companion_id = %d LIMIT 1",$id);
$result = mysql_query($query,$dbConnection);
$returnArray = mysql_fetch_array($result);
return $returnArray;
} else {
die("This script is protected against SQL injection.");
}
}
Kind regards,
Maurits