title: Pass parameter query
body: <p>I am trying to get lat, lng according to the city. When I latterly write the city ('Buffalo') within the query it works. I want to use different cities.</p>
  
  <pre><code>public function getLatLng($data, $city) {
      $count_data = count($data);
      for($i = 0; $i &lt; $count_data; $i++) {
          $latlngs = array();
          $stmt = $this -&gt; conn -&gt; prepare("SELECT g.lat, g.lng
            FROM news_locations AS nl INNER JOIN geolocations AS g
            ON g.geolocation_id = nl.geolocation_id
            WHERE nl.news_id = ". $data[$i]["news_id"] ."
            AND nl.is_deleted = 0 AND g.city = 'Buffalo'");
          if ($stmt -&gt; execute()) {
              $stmt -&gt; bind_result($lat, $lng);
              while($stmt -&gt; fetch()) {
                 $row = array();
                 $row["lat"] = $lat;
                 $row["lng"] = $lng;
                 array_push($latlngs, $row);
              }
              $stmt -&gt; close();
          }
          $data[$i]['latlng'] = array_values($latlngs);
      }
      return $data;
  }
  </code></pre>
  
  <p>I have tried to write </p>
  
  <pre><code>AND g.city = " . $city);
  </code></pre>
  
  <p>Also tried</p>
  
  <pre><code>AND g.city = :city");
  if ($stmt -&gt; execute(array('city' =&gt; $city))) {
  </code></pre>
  
  <p>Both did not work. How to pass the parameter $city to query?</p>