android - Error in php script when hosted in the remote server only -
i have android app php backend, problem 1 of php scripts works on local server while when online not , produce following error:
parse error: syntax error, unexpected '"', expecting t_string or t_variable or t_num_string in /home/malblbic/public_html/webservice/profile.php on line 23
here php code.
<?php /* our "config.inc.php" file connects database every time include or require within php script. since want script add new user our db, talking our database, , therefore, let's require connection happen: */ require("config.inc.php"); //initial query $username = $_post['username']; $query = "select * users; //execute query try { $stmt = $db->prepare($query); $result = $stmt->execute(); } catch (pdoexception $ex) { $response[‘success’] = 0; $response["message"] = "database error!"; die(json_encode($response)); } // finally, can retrieve of found rows array using fetchall $rows = $stmt->fetchall(); if ($rows) { $response["success"] = 1; $response["message"] = "user available!"; $response["posts"] = array(); foreach ($rows $row) { $post = array(); $post["picture"] = $row["picture"]; $post["username"] = $row["username"]; $post["points"] = $row["points"]; //update our repsonse json data array_push($response["posts"], $post); } // echoing json response echo json_encode($response); } else { $response["success"] = 0; $response["message"] = "no users available!"; die(json_encode($response)); } ?>
change backticks regular quotes
$response[‘success’] = 0; to
$response['success'] = 0;
Comments
Post a Comment