如果两个表之间没有相同的数据,可以打印其他表数据

时间:2018-08-01 12:06:01

标签: mysql php

示例:

x和y表可用。

x表中的构造。

y表中有要做的事情清单。

如果我从表y中完成了一项任务,它将被转移到表x中。

如何打印未完成的列表?

多线程:StackOverflow

<?php
$advertisement_query = mysql_query("SELECT * FROM andesite_advertisement INNER JOIN andesite_adsrice ON (andesite_advertisement.advertisement_base = andesite_adsrice.adsrice_adsase) WHERE andesite_adsrice.adsrice_username = '$user_nickname'");
$ads_q_query = mysql_query("SELECT * FROM andesite_advertisement");
$num_log = mysql_num_rows($advertisement_query);
if ($num_log > 0){
    while (($ads_row = mysql_fetch_array($advertisement_query)) && ($ads_q_row = mysql_fetch_array($ads_q_query))) {


            $timeA = $ads_row['adsrice_time'];
            $timeB = date("d.m.Y H:i");
            $timeDiff = strtotime($timeB) - strtotime($timeA);

            if ($timeDiff > $ads_time){
                echo '<tr>
                        <td>'.$ads_q_row['advertisement_id'].'</td>
                        <td>'.$ads_q_row['advertisement_title'].'</td>
                        <td><a class="btn btn-success btn-success flat btn-xs" href="/Surf/'.$ads_q_row['advertisement_base'].'" target="_blank"><i class="fa fa-eye"></i>&nbsp;'.ls_view.'</a></td>
                    </tr>
                ';
            }
            if(mysql_result($advertisement_query, 0, 0) > 0) {
} else {
   echo '<tr>
                        <td>'.$ads_q_row['advertisement_id'].'</td>
                        <td>'.$ads_q_row['advertisement_title'].'</td>
                        <td><a class="btn btn-success btn-success flat btn-xs" href="/Surf/'.$ads_q_row['advertisement_base'].'" target="_blank"><i class="fa fa-eye"></i>&nbsp;'.ls_view.'</a></td>
                    </tr>
                ';
}


    }
} else {
    $ads_f_query = mysql_query("SELECT * FROM andesite_advertisement");
    while($ads_f_row = mysql_fetch_array($ads_f_query)){
   echo '<tr>
                        <td>'.$ads_f_row['advertisement_id'].'</td>
                        <td>'.$ads_f_row['advertisement_title'].'</td>
                        <td><a class="btn btn-success btn-success flat btn-xs" href="/Surf/'.$ads_f_row['advertisement_base'].'" target="_blank"><i class="fa fa-eye"></i>&nbsp;'.ls_view.'</a></td>
                    </tr>
                ';
    }
}
?>

0 个答案:

没有答案