Dear all i have 1 problem could you please help me
class SelectDatabase{
function select($connect,$field,$table){
$query = "SELECT ".$field." FROM ".$table;
$stmt = $connect->prepare($query);
$stmt->execute();
return $stmt;
}
//public function __destruct(){}
}
$test = new SelectDatabase();
$test-> select($con,"*","test");
while($row = $test->fetch(PDO::FETCH_ASSOC)){
echo $row['field1'].' '.$row['field2'].' '.$row['field3'].'<br />';
}
when i create function it work perfectly after i add it into the class it error now i have no idea with it
but the error happened:
Fatal error: Call to undefined method SelectDatabase::fetch() in C:\wamp\www\localtesting.com\ est\ est.php on line 84
please help me