Hello everyone!
After reading a lot of security-related articles on the net (and being blown away by everything that can go wrong), I’d like to know if the following would be a secure way to get information from a database:
function getInformation($id,$dbConnection){
if(is_int($id)){
$query = sprintf("SELECT * FROM table WHERE idcolumn = %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.");
}
}
Does anyone here have any suggestions as far as security is concerned? (or any other comments are always welcome, of course)
Any thoughts would be greatly appreciated!
Kind regards,
Maurits