<?php
$con = mysqli_connect("192.168.136.129","root","1213800", "computer_accessories");
if (!$con)
{
    die('Could not connect: ' . mysqli_error($con));
}
// 设置编码，防止中文乱码
mysqli_set_charset($con, "utf8");
$sql="select * from trendings order by frequency desc limit 3;";

$result = mysqli_query($con,$sql);

$recLists = array();
while($rec = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
    $recLists[] = $rec;
}
$recDict = json_encode($recLists);
echo $recDict;
