php mysql query WHERE columnName equals a variable
<p>So I have this php code:</p>

<pre><code>$des = 'Caticlan, Aklan';

require_once('dbConnect.php');

$sql = "SELECT * FROM appDB WHERE route='".$des."%'";
$r = mysqli_query($con,$sql) or die(mysqli_error($con));


$result = array();

//$row = mysqli_fetch_array($r);
while($row = mysqli_fetch_array($r)){
array_push($result,array(
        "id"=&gt;$row['id'],
        "route"=&gt;$row['route'],
        "busName"=&gt;$row['busName'],
        "busType"=&gt;$row['busType'],
        "assignedTerminal"=&gt;$row['assignedTerminal'],
        "timeFirstTrip"=&gt;$row['timeFirstTrip'],
        "timeLastTrip"=&gt;$row['timeLastTrip'],
        "timeInterval"=&gt;$row['timeInterval'],
        "estFare"=&gt;$row['estFare'],
        "estDistance"=&gt;$row['estDistance'],
        "estTravelTime"=&gt;$row['estTravelTime'],
        "DualRoute"=&gt;$row['DualRoute']

));  }

echo json_encode(array('busDetails'=&gt;$result));

mysqli_close($con);
</code></pre>

<p>It should return data from db which matches <code>$des</code> in the query (and in <code>JSON</code> format). I tried to run this one but it only shows this result:</p>

<pre><code>{"busDetails":[]}
</code></pre>

<p>But I expect it to return like this:</p>

<pre><code>{
"busDetails": [{
    "id": "8",
    "route": "Caticlan, Aklan",
    "busName": "Ceres Liner",
    "busType": "regular",
    "assignedTerminal": "Molo Terminal",
    "timeFirstTrip": "03:30:00",
    "timeLastTrip": "20:15:00",
    "timeInterval": "20",
    "estFare": "0",
    "estDistance": "270",
    "estTravelTime": "4hrs 27min",
    "DualRoute": "San Jose, Pandan, Libetad"
}, {
    "id": "17",
    "route": "Caticlan, Aklan",
    "busName": "Ceres Liner",
    "busType": "regular",
    "assignedTerminal": "Ceres Terminal",
    "timeFirstTrip": "02:30:00",
    "timeLastTrip": "17:00:00",
    "timeInterval": "30",
    "estFare": "0",
    "estDistance": "226",
    "estTravelTime": "4hr 33min",
    "DualRoute": "Kalibo, Passi City"
}, {
    "id": "18",
    "route": "Caticlan, Aklan",
    "busName": "Ceres Liner",
    "busType": "aircon",
    "assignedTerminal": "Ceres Terminal",
    "timeFirstTrip": "03:00:00",
    "timeLastTrip": "17:00:00",
    "timeInterval": "30",
    "estFare": "370",
    "estDistance": "226",
    "estTravelTime": "4hr 33min",
    "DualRoute": "Kalibo, Passi City"
}]
}
</code></pre>

<p>There are no errors displayed. And I don't see any error in the syntax either. </p>