Advertisement
Guest User

Untitled

a guest
Apr 16th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. Fragment Swifta, który odpowiada za echo wiadomości (faza testowa, żeby w końcu zobaczyć, że działa)
  2. let resultValue:String = parseJSON["status"] as! String;
  3. let resultValue2:String = parseJSON["message"] as! String;
  4. print("result: \(resultValue), \(resultValue2)");
  5.  
  6. Fragment login.php, który odpowiada ze sklecenie wiadomości (to też działa)
  7. $hi = $dao->hello($email);
  8. if(!empty($userDetails) || !empty($userDetails2)) {
  9. $returnValue["status"] = "Success";
  10. $returnValue["message"] = "Zalogowano jako $hi";
  11. echo json_encode($returnValue); }
  12.  
  13. Fragment mysql.php, czyli właściwy skrypt, który... nie działa
  14.  
  15. public function hello($email)
  16. {
  17. $sql = mysql_query("select user_name from users where user_email='" . $email . "'");
  18. $user_name_object = mysql_fetch_object($sql);
  19. $user_name = $user_name_object->user_name;
  20. return $user_name;
  21. }
  22.  
  23. 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:
  24. 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