diff --git a/api-rest/gateways/userGateway.php b/api-rest/gateways/userGateway.php index 4fb4717..8b26fbc 100644 --- a/api-rest/gateways/userGateway.php +++ b/api-rest/gateways/userGateway.php @@ -128,7 +128,7 @@ class UserGateway{ /// Returning TRUE if the user has been added succesfully, FALSE otherwise public function postUser(string $username, string $password, string $nationality, string $sex, string $dateOfBirth) { $insertUserQuery = "INSERT INTO T_S_USER_USR VALUES (NULL, :username, :password, :nationality, :sex, :dateOfBirth, 0, 0, 0, 1)"; - $getLastIdQuery = "SELECT max(PK_ID) FROM T_S_USER_USR"; + $getLastIdQuery = "SELECT max(PK_ID) id FROM T_S_USER_USR"; $argUser=array('username' => array($username, PDO::PARAM_STR), 'password' => array($password, PDO::PARAM_STR), 'nationality' => array($nationality, PDO::PARAM_STR), @@ -138,8 +138,7 @@ class UserGateway{ $this->connection->execQuery($getLastIdQuery, array()); $res=$this->connection->getRes(); foreach($res as $row){ - echo "la je met le premier"; - $this->putSkinList($row['PK_ID'], 1); + $this->putSkinList($row['id'], 1); } } diff --git a/api-rest/index.php b/api-rest/index.php index 5fe13b3..a58696e 100644 --- a/api-rest/index.php +++ b/api-rest/index.php @@ -182,7 +182,6 @@ break; case 'POST': if($method_name === "postUser"){ // test : OK - echo count($url); if (count($url)<7){ //header("HTTP/1.0 400 Invalid number of arguments"); http_response_code(400); @@ -193,7 +192,6 @@ $sex = !empty($url[6]) ? (string) $url[6] : null; $dateOfBirth = !empty($url[7]) ? (string) $url[7] : null; $usergw->postUser($username,$password,$nationality,$sex,$dateOfBirth); - echo "je le met"; http_response_code(200); } elseif($method_name === "postMatch"){ // test : OK