i have register form in android application, first made register/login page , worked fine.
just before wanted go live, checked , noticed when registered, i'm not returning loginscreen. checked logcat , showed me following error:
register response: fatal error: call undefined method mysqli_stmt::get_result() in /var/www/domain/app/android_login_api/include/db_functions.php on line 46
so checked php script , noticed giving error on $stmt->bind_result($email);
/** * storing new user * returns user details */ public function storeuser($name, $email, $password) { $uuid = uniqid('', true); $hash = $this->hashssha($password); $encrypted_password = $hash["encrypted"]; // encrypted password $salt = $hash["salt"]; // salt $stmt = $this->conn->prepare("insert users(unique_id, name, email, encrypted_password, salt, created_at) values(?, ?, ?, ?, ?, now())"); $stmt->bind_param("sssss", $uuid, $name, $email, $encrypted_password, $salt); $result = $stmt->execute(); $stmt->close(); // check successful store if ($result) { $stmt = $this->conn->prepare("select * users email = ?"); $stmt->bind_param("s", $email); $stmt->execute(); $stmt->bind_result($email); //$user = $stmt->get_result()->fetch_assoc(); $stmt->close(); return $user; } else { return false; } }
php ain't strongest side, i'm 100% worked 1 , half month ago. problem be?
fyi:
this location registration processed in application:
private void registeruser(final string name, final string email, final string password) { // tag used cancel request string tag_string_req = "req_register"; pdialog.setmessage("registering ..."); showdialog(); stringrequest strreq = new stringrequest(method.post, appconfig.url_register, new response.listener<string>() { @override public void onresponse(string response) { log.d(tag, "register response: " + response.tostring()); hidedialog(); try { jsonobject jobj = new jsonobject(response); boolean error = jobj.getboolean("error"); if (!error) { // user stored in mysql // store user in sqlite string uid = jobj.getstring("uid"); jsonobject user = jobj.getjsonobject("user"); string name = user.getstring("name"); string email = user.getstring("email"); string created_at = user.getstring("created_at"); // inserting row in users table db.adduser(name, email, uid, created_at); toast.maketext(getapplicationcontext(), "registration succesfull", toast.length_long).show(); // launch login activity intent intent = new intent( registeractivity.this, loginactivity.class); startactivity(intent); finish();
Comments
Post a Comment