I am currently trying to get a PDO SELECT statement to work with a variable passed in through the parameter of the function it is contained within. I am using this function to return values to the class constructor.
Here is the function for which i am encountering a "Fatal error: Call to a member function prepare() on a non-object"
public function select($field) {
global $pdo;
$query = $pdo->prepare("SELECT `".$field."` FROM `iwp_incident` WHERE `incident_id=`". $this->oid ."`");
$query->execute();
$result = $query->fetch();
return $result[0];