I'm working on a website in which I would like to use PHP and MySQL. Mostly I insert hundreds of variables into my MySQL database but I am getting tired of this. I have searched the internet for a solution but without any succes.
My website uses Object Oriented PHP and I would like to insert the whole instance into the database. Example:
class User { private $userID; private $username; // etc public function __construct($userID, $username) { $this->userID = $userID; $this->username = $username } // Other functions go here } I would like to know if I could save a whole instance ($user = new User($x, $y)) into my MySQL database. If possible, what field type do I need?
Thanks in advance.
query("INSERT INTO `table` VALUES (".(string)$user.");");.