سلام من یه دیتا بیس ساختم به اسم 7todo ولی وصل نمیشه
زمپ هم فعاله
db = new PDO("mysql:dbname=7todo;host=localhost", 'root', '');
} catch (PDOException $e) {
die('Connection failed: ' . $e->getMessage());
}
}
public function find($id){
$sql = "select * from {$this->table} where {$this->primaryKey} = :id";
$stmt = $this->db->prepare($sql);
$stmt->execute([':id' => $id]);
return $stmt->fetch(PDO::FETCH_OBJ);
}
public function update($data){
# code for update a model
}
public function create($data){
# code for create a model
}
public function delete($id){
$sql = "delete from {$this->table} where {$this->primaryKey} = :id";
$stmt = $this->db->prepare($sql);
$stmt->execute([':id' => $id]);
return $stmt->rowCount();
}
}