PHP SQL结果在新的sql查询中存储为var

时间:2017-03-22 00:41:03

标签: php mysql

所以它是一个PHP游戏等......

这是我脚本的主要部分;

$sql = "SELECT * from search1 WHERE username='Hitachi'";
$result = mysqli_query($connection, $sql);

while ($rows = mysqli_fetch_array($result)) {
    $timeleft = $rows['time'];
    $target55 = $rows['target'];
    $id = $rows['id'];
    $status = $rows['status'];
    $hours = $rows['hours'];
    $started = $rows['started'];
    $deletetime = $started - 86400;

    mysqli_query($connection, "DELETE FROM search WHERE started<'$deletetime'");
    $starttime = $started;
    $time1 = $starttime + 10800;

    $a_query = mysqli_query($connection, "SELECT * FROM BG WHERE username='$target55' AND status='Ready'");
    $check_found = mysqli_num_rows($a_query);

    if ($check_found >= 1) {
        $bg = mysqli_query($connection, "SELECT * FROM BG WHERE status='Ready' AND username='$target55' ORDER by slot DESC LIMIT 1");
        while ($i = mysqli_fetch_object($bg)) {
            $bg1 = $i->bodyguard;
        }

        echo "This user has a bodyguard called <b>$bg1</b>!";
        if ($time1 < time() && $hours >= 3 || $userlevel >= 14) {
            $sql2 = "SELECT * from users WHERE username='$target55'";
            $result2 = mysqli_query($connection, $sql2);
            while ($rows2 = mysqli_fetch_array($result2)) {
                $target_country = $rows2['country'];
            }

            mysqli_query($connection, "UPDATE search1 SET status='2', location='$target_country', found='$target_country' WHERE id='$id'");
        }

        mysqli_query($connection, "DELETE FROM BG WHERE username='$target55'");

无论是否有保镖,这都没有任何作用。 如果我删除了对保镖等的检查,那么它可以工作,但我需要检查吗?

0 个答案:

没有答案