Я хочу сохранить объект PHP в базе данных MySQL. Пример:
Код: Выделить всё
class user{
private $id, $email, $pw, $first, $last, $group,.....;
// getters and setters
}
class someclass{
public function someFunction(){
$pdo = new PDO(...);
$objUser = new user();
$objUser->setEmail(....);
$objUser->setFirst(....);
//bla bla bla
// and I want to save this user object to the DB with something like:
$pdo->insert($objUser); //in this case db table equals to class name
//instead of building/writing query manually.
//for mysql_query I have made a class for building queries for insert, update and delete
//but mysq_query is old and deprecated
}
}
Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/211 ... o-database
Мобильная версия