Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fragment Swifta, który odpowiada za echo wiadomości (faza testowa, żeby w końcu zobaczyć, że działa)
- let resultValue:String = parseJSON["status"] as! String;
- let resultValue2:String = parseJSON["message"] as! String;
- print("result: \(resultValue), \(resultValue2)");
- Fragment login.php, który odpowiada ze sklecenie wiadomości (to też działa)
- $hi = $dao->hello($email);
- if(!empty($userDetails) || !empty($userDetails2)) {
- $returnValue["status"] = "Success";
- $returnValue["message"] = "Zalogowano jako $hi";
- echo json_encode($returnValue); }
- Fragment mysql.php, czyli właściwy skrypt, który... nie działa
- public function hello($email)
- {
- $sql = mysql_query("select user_name from users where user_email='" . $email . "'");
- $user_name_object = mysql_fetch_object($sql);
- $user_name = $user_name_object->user_name;
- return $user_name;
- }
- Jeśli w funkcję hello wpiszę samo $user_name = "Wojtek" i return $user_name to po zalogowaniu się witany jest Wojtek. Transport w takim razie jest ok, kwestia samej funkcji, z którą męczę się już 3 albo i 4 godziny... nie mam już pomysłów więc liczę na obeznanego Mirka. Cokolwiek próbuję tu sklecić, to dostaję od xcode:
- Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement