-1

I'm getting this error on the following line of my PHP Script which is responsible for executing the mysqli_query. I'm not sure why it is occuring there :

syntax error, unexpected T_VARIABLE, expecting ']'

<?php
$response = array("error" => FALSE);


if (isset($_POST['city']) && isset($_POST['offset']) != '') {

 $city= $_POST['city'];
 $offset = $_POST['offset];




 $conn=mysqli_connect("****.com", "***", "***","****");


$get_images= mysqli_query($conn,"SELECT user_id, image, longitude, latitude, city, geo_name_id, description, score, Categories FROM images WHERE geo_name_id = '$city' LIMIT 10 OFFSET '$offset'");

 $myArray = array();
$returnArray = array();
while($row = $get_images->fetch_array())
{
 $myArray["user_id"] = $row["user_id"];
 $myArray["image"] = $row["image"];
 $myArray["longitude"] = $row["longitude"];
 $myArray["latitude"] = $row["latitude"];
 $myArray["city"] = $row["city"];
 $myArray["geo_name_id"] = $row["geo_name_id"];
 $myArray["description"] = $row["description"];
 $myArray["score"] = $row["score"];
 $myArray["Categories"] = $row["Categories"];

 $returnArray[] = $myArray;
}
echo json_encode($returnArray);


  }   

  ?>        

I don't really see where it can expect a ] here...

Alk
  • 5,215
  • 8
  • 47
  • 116
  • Please provide code for the variables you are setting in this line. – Josh S. Feb 28 '16 at 04:25
  • The error occurs in other parts of your code, you'll need to include more of your code – Panda Feb 28 '16 at 04:26
  • Makee, please read this information on how to craft a good code example: http://stackoverflow.com/help/mcve . FYI, your problem is undoubtedly caused by a syntax error higher up in your code. – CollinD Feb 28 '16 at 04:27
  • I updated the code, relax.. – Alk Feb 28 '16 at 04:28

1 Answers1

2

You've missed out the close quote at:

$city= $_POST['city'];
$offset = $_POST['offset];

It should be: $offset = $_POST['offset']; instead.

Panda
  • 6,955
  • 6
  • 40
  • 55