Доброго времени суток, столкнулся с данной проблемой.
Warning: Error while sending QUERY packet. PID=1011 in /home/admin/web/test/public_html/nicecoin/auto_score/vendor/krugozor/database/src/Mysql/Mysql.php on line 389
PHP Fatal error: Uncaught Krugozor\Database\Mysql\Exception: Krugozor\Database\Mysql\Mysql::query: MySQL server has gone away; SQL: SELECT vk_id,card,cardrack,videocardroom FROM auto1 in /home/admin/web/test/public_html/nicecoin/auto_score/vendor/krugozor/database/src/Mysql/Mysql.php:396
Stack trace:
#0 /home/admin/web/test/public_html/nicecoin/auto_score/script.php(25): Krugozor\Database\Mysql\Mysql->query('SELECT vk_id,ca...')
#1 {main}
thrown in /home/admin/web/test/public_html/nicecoin/auto_score/vendor/krugozor/database/src/Mysql/Mysql.php on line 396
Для работы с MySQL использую библиотеку VENDOR. Это происходит при выполнении скрипта в консоли.
Вот сам скрипт.
require '/home/admin/web/test/public_html/nicecoin/auto_score/vendor/autoload.php';
use Krugozor\Database\Mysql\Mysql as Mysql;
$db = Mysql::create("localhost", "**********", "*********")->setDatabaseName("**********")->setCharset("utf8");
echo "Ok";
$auto1 = $db->query("SELECT vk_id,card,cardrack,videocardroom FROM auto1");
while ($row = $auto1->fetch_assoc()) {
$ins = $row['card'] * "3.75" + $row['cardrack'] * "7.5" + $row['videocardroom'] * "15";
$id = $row['vk_id'];
$bans = $db->query("SELECT ban from score WHERE vk_id = $id");
while ($rowban = $bans->fetch_assoc()) {
$ban = $rowban['ban'];
}
if ($ban == "0") {
$db->query("UPDATE score SET score = score + $ins WHERE vk_id = $id LIMIT 1");
}
}
sleep(15);
echo "Ok";
$auto2 = $db->query("SELECT vk_id,card,cardrack,videocardroom FROM auto1");
while ($row2 = $auto2->fetch_assoc()) {
$ins = $row2['card'] * "3.75" + $row2['cardrack'] * "7.5" + $row2['videocardroom'] * "15";
$id = $row2['vk_id'];
$bans = $db->query("SELECT ban from score WHERE vk_id = $id");
while ($rowban = $bans->fetch_assoc()) {
$ban = $rowban['ban'];
}
if ($ban == "0") {
$db->query("UPDATE score SET score = score + $ins WHERE vk_id = $id LIMIT 1");
}
}
sleep(15);
Помогите, а то что то приуныл с данным вопросом.
Спасибо заранее ;)