执行许多mysql_query并保存时间

时间:2013-08-29 03:41:58

标签: php mysql

我尝试同时执行许多查询,但大约需要1-2分钟才能崩溃。我也试图最大限度地执行,但使用set_time_limit(120)它仍然崩溃。我已经看到mysqli_multi_query将是一个不错的选择,但我不知道它是否会与我合作。

    mysql_query("UPDATE `lotto_gameplay` SET `six_digit_result`=1 WHERE EXISTS ( SELECT `lotto_main`.*,`lotto_gameplay`.* FROM `lotto_main` WHERE `lotto_main`.`lotto_num` = `lotto_gameplay`.`six_digit`  AND `lotto_main`.`postdate`='".$datt."'AND `lotto_main`.`lotto_type`='0' AND `lotto_gameplay`.`status`='0' )");

    mysql_query("UPDATE `lotto_gameplay` SET `six_digit_result`=2 WHERE EXISTS ( SELECT `lotto_main`.*,`lotto_gameplay`.* FROM `lotto_main` WHERE `lotto_main`.`lotto_num` = `lotto_gameplay`.`six_digit`  AND `lotto_main`.`postdate`='".$datt."'AND `lotto_main`.`lotto_type`='3' AND `lotto_gameplay`.`status`='0')");

    mysql_query("UPDATE `lotto_gameplay` SET `six_digit_result`=3 WHERE EXISTS ( SELECT `lotto_main`.*,`lotto_gameplay`.* FROM `lotto_main` WHERE `lotto_main`.`lotto_num` = `lotto_gameplay`.`six_digit`  AND `lotto_main`.`postdate`='".$datt."'AND `lotto_main`.`lotto_type`='4' AND `lotto_gameplay`.`status`='0')");


    mysql_query("UPDATE `lotto_gameplay` SET `six_digit_result`=4 WHERE EXISTS ( SELECT `lotto_main`.*,`lotto_gameplay`.* FROM `lotto_main` WHERE `lotto_main`.`lotto_num` = `lotto_gameplay`.`six_digit`  AND `lotto_main`.`postdate`='".$datt."'AND `lotto_main`.`lotto_type`='5' AND `lotto_gameplay`.`status`='0')");

    mysql_query("UPDATE `lotto_gameplay` SET `six_digit_result`=5 WHERE EXISTS ( SELECT `lotto_main`.*,`lotto_gameplay`.* FROM `lotto_main` WHERE `lotto_main`.`lotto_num` = `lotto_gameplay`.`six_digit`  AND `lotto_main`.`postdate`='".$datt."'AND `lotto_main`.`lotto_type`='6' AND `lotto_gameplay`.`status`='0')");

    mysql_query("UPDATE `lotto_gameplay` SET `six_digit_result`=6 WHERE EXISTS ( SELECT `lotto_main`.*,`lotto_gameplay`.* FROM `lotto_main` WHERE `lotto_main`.`lotto_num` = `lotto_gameplay`.`six_digit`  AND `lotto_main`.`postdate`='".$datt."'AND `lotto_main`.`lotto_type`='7' AND `lotto_gameplay`.`status`='0')");

0 个答案:

没有答案