I am only having my very first attempt to use the new method, since I was advised to begin using PDO method to instead of the old one for querying the DB.
I cannot figure out how to place the variable into it as I was doing previously with my old one.
here is an old version of my script
$file_code = filter_input( INPUT_GET, 'fileid' );
$res = mysql_query("SELECT * FROM `Files` WHERE `fileID`='".$file_code."'") or die ( mysql_error() );
if(mysql_num_rows($res) == 0)
{
die(header("Location: error.php"));
}
$info = mysql_fetch_assoc($res);
and here is my attempt to use the new way to achieve the same result
$file_code = filter_input( INPUT_GET, 'fileid' );
$db = new PDO($host,$db_name,$db_user,$db_pass);
$res = $db->prepare('SELECT * FROM Files WHERE fileID = :".$file_code."');
Can you please help me with it since I am not a PRO in php
Thanks in advance