我正在我的mysql数据库中检索5000多个数据。我需要5-10分钟来检索数据(只有在通过网络时,它只是本地速度较慢)有没有办法不使用插件来提高速度?
$ContactID = $_GET["Contact"];
$sql = "SELECT * FROM tblContacts WHERE Coordinator = '$ContactID'";
$result = mysqli_query($conn, $sql);
$count = mysqli_num_rows($result);
if($count > 0){
while ($row = mysqli_fetch_array($result)) {
$supdate = date("Y-m-d h:i", strtotime($row['ServerUpdate']));
$mupdate = date("Y-m-d h:i", strtotime($row['MobileUpdate']));
$ar[] = array(
'ContactID' => $row['ContactID'],
'FileAs' => $row['FileAs'],
'FirstName' => $row['FirstName'],
'MiddleName' => $row['MiddleName'],
'LastName' => $row['LastName'],
'Position' => $row['Position'],
'Company' => $row['Company'],
'CompanyID' => $row['CompanyID'],
'ContactType' => $row['ContactType'],
'RetailerType' => $row['RetailerType'],
'PresStreet' => $row['PresStreet'],
'PresBarangay' => $row['PresBarangay'],
'PresDistrict' => $row['PresDistrict'],
'PresTown' => $row['PresTown'],
'PresProvince' => $row['PresProvince'],
'PresCountry' => $row['PresCountry'],
'Landmark' => $row['Landmark'],
'Telephone1' => $row['Telephone1'],
'Telephone2' => $row['Telephone2'],
'Mobile' => $row['Mobile'],
'Email' => $row['Email'],
'Employee' => $row['Employee'],
'Customer' => $row['Customer'],
'Coordinator' => $row['Coordinator'],
'ServerUpdate' => $supdate,
'MobileUpdate' => $mupdate
);
}
print json_encode($ar);
}
2条答案
按热度按时间a6b3iqyw1#
必须首先在顶部声明数组的变量。
您可以直接从mysql调用所需的数据。希望能有所帮助。
vohkndzv2#
可能是这样的。
为多个记录更新