diff --git a/php/binary_data/user-1.php b/php/binary_data/user-1.php index 50a12bc..c68a811 100644 --- a/php/binary_data/user-1.php +++ b/php/binary_data/user-1.php @@ -1,33 +1,43 @@ fname."', '".$this->lname."', '".$this->profilePic."')"; - echo $queryStr; - $result = parent::executeQuery($queryStr); - if ($result === TRUE) { - $uid = parent::returnLastRecordID(); - $success = $uid; - } else { - $success = FALSE; - } +class users extends database { + public $fname; + public $lname; + public $profilePic; + public $email; + public $password; + public $userid; - parent::disconnect_from_database(); - return $success; -} + public function saveUserDatav2() { + parent::connect_to_database("localhost", "barreto", "sTovok0r", "movieCollection"); + $queryStr = "INSERT INTO `users` (`userID`, `fname`, `lname`, `pic`) VALUES (NULL, ?, ?, ?)"; + $params = [$this->fname, $this->lname, $this->profilePic]; + $result = parent::executeQuery($queryStr, $params); -public function getRecordById($myid) { - parent::connect_to_database("localhost", "barreto", "sTovok0r", "movieCollection"); - $queryStr = "SELECT * FROM 'users' WHERE 'userID' = ".$myid; - parent::executeQuery($queryStr); - $profileInfo = parent::getResultSet(); - $this->userid = $profileInfo['userID']; - $this->fname = $profileInfo['fname']; - $this->lname = $profileInfo['lname']; - $this->profilePic = $profileInfo['pic']; - $this->email = $profileInfo['email']; - $this->password = crypt($profileInfo['password'],"sdjeyrfgdb4334"); - parent::disconnect_from_database(); -} + if ($result === TRUE) { + $uid = parent::returnLastRecordID(); + $success = $uid; + } else { + $success = FALSE; + } + + parent::disconnect_from_database(); + return $success; + } + + public function getRecordById($myid) { + parent::connect_to_database("localhost", "barreto", "sTovok0r", "movieCollection"); + $queryStr = "SELECT * FROM `users` WHERE `userID` = ?"; + $params = [$myid]; + parent::executeQuery($queryStr, $params); + $profileInfo = parent::getResultSet(); + $this->userid = $profileInfo['userID']; + $this->fname = $profileInfo['fname']; + $this->lname = $profileInfo['lname']; + $this->profilePic = $profileInfo['pic']; + $this->email = $profileInfo['email']; + $this->password = crypt($profileInfo['password'],"sdjeyrfgdb4334"); + parent::disconnect_from_database(); + } // Getter methods from the users class @@ -47,7 +57,8 @@ public function getEmail() { return $this->email; } -public function getPassword() { - return $this->password; + public function getPassword() { + return $this->password; + } } ?> \ No newline at end of file