I have got a problem in mysql: My PHP gets disconnected from MySQL for a simple query. The error is:
Lost connection to MySQL server during query.
And it is thrown from :
$stmt->execute();
$app->post('/checkmd5', function() use($app) {
$data = $app->request()->params();
$version = $data["VERSION"];
$md5 = $data["MD5"];
$stmt = getDb()->prepare("SELECT MD5 FROM UpdateInfo WHERE VersionName = ?");
$stmt->bind_param("s", $version);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows() > 0) {
$stmt->bind_result($dbMD5);
$stmt->fetch();
if ($md5 == $dbMD5)
{
$app->render(200, array("SUCCESS_MD5_MATCH", "VALID" => "true"));
}
else
{
$app->render(400, array("msg" => "ERROR_NO_MD5_MATCH", "VALID" => "false"));
}
}
else
{
$app->render(400, array("msg" => "ERROR_VERSION_STRING_NOT_FOUND", "VALID" => "false", "VERSION" => $version));
}
});
只需将getDb()的返回值保存到变量中即可解决该问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.