Hello I have been finding issues in code that was working fine before the $conn is giving error It is a simple insert with pdo in Php I have a connection class which works fine through i perform following operations in my file
// query
try{
$sql="INSERT INTO vup_file(filename,path,category,sub_category,user_id,comment,language,duration)
VALUES (:filename,:path,:category,:subcategory,:user_id,:comment,:language,:duration)";
global $conn;
$query=$conn->prepare($sql);
$query->execute
(array(':filename'=>$filename,':path'=>$path,':category'=>$category,':subcategory'=>$subcategory,':user_id'=>$user_id,':comment'=>$comment,':language'=>$language,':duration'=>$duration));
echo 'Success';
}catch(PDOException $e)
{
echo 'ERROR OCCURED : '.$e->getMessage();
}
}
I am getting a error of Call to a member function prepare() on a non-object in line 62
I tried to make $conn
but that just didn't work
how to get rid of this error ?