php - errors: [1] 0: {message: "Undefined offset: 1} -


i receiving php error errors: [1] 0: { message: "undefined offset: 1 (error number: 8), (file: /users/akashpatel/documents/ios development/rideshare/rideshareapi/src/frapi/library/frapi/controller/api.php @ line 299)" name: "php notice error" at: "" }.

below code.

if (isset($_server['http_login']))      {         list($userid, $apikey) = explode(':',  base64_decode($_server['http_login']));          $this->setuserid($userid);         $this->setapikey($apikey);          //check against db         $sql = "select * user id=:userid , apikey=:apikey";          $stmt = $db->prepare($sql);          $stmt->bindparam(':userid', $this->getuserid());         $stmt->bindparam(':apikey', $this->getapikey());                                  try          {             $stmt->execute();             $user = $stmt->fetchobject();         }         catch(pdoexception $err)         {             echo $err->getmessage();         }          if ($user == null)             throw new frapi_error('status_forbidden');     }     else     {         $this->username = false;         $this->apikey = false;          throw new frapi_error(             frapi_error::error_invalid_action_request_name,             frapi_error::error_invalid_action_request_msg,             frapi_error::error_invalid_action_request_no,             frapi_error::error_invalid_action_request_http_msg         );     }  

thanks in advance.

edit : sorry everyone. passed incorrect values. use correct one, getting error error_invalid_action_request. may because goes else. not getting can reason. edited code.

this means string did not explode 2 parts , resulting array not have offset 1. should not list()-assign variables unless 2000% sure have many indexes in array you're assigning. in case it's out of control, better check first.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -