PHP 2 tablo arasındaki fark

x (adsrice) ve y (adver) tabloları içinde ortak olan hash değeri mevcut. Şimdi:

x tablosunda y tablosunun hash değeri yoksa y tablosunu yazdırsın.

x tablosunda y tablosunun hash değeri varsa y tablosundaki hash'ı yazdırsın.

<?php
$adsrice_query = mysql_query("SELECT * FROM andesite_adsrice WHERE adsrice_username = '$user_nickname'");
$advertisement_query = mysql_query("SELECT * FROM andesite_advertisement");
$num_log = mysql_num_rows($adsrice_query);
if($num_log > 0){
    while(($ads_row = mysql_fetch_assoc($adsrice_query)) && ($ade_row = mysql_fetch_assoc($advertisement_query))) {
	if(!$ads_row['adsrice_adsase']){
		echo '<tr>
                        <td>'.$ade_row['advertisement_id'].'</td>
                        <td>'.$ade_row['advertisement_title'].'</td>
                        <td><a class="btn btn-success btn-success flat btn-xs" href="/Surf/'.$ade_row['advertisement_base'].'" target="_blank" onclick="window.close()"><i class="fa fa-eye"></i>&nbsp;'.ls_view.'</a></td>
                    </tr>
                ';
	}else{
		if($ads_row['adsrice_adsase'] != $ade_row['advertisement_base']){
				echo '<tr>
                        <td>'.$ade_row['advertisement_id'].'</td>
                        <td>'.$ade_row['advertisement_title'].'</td>
                        <td><a class="btn btn-success btn-success flat btn-xs" href="/Surf/'.$ade_row['advertisement_base'].'" target="_blank" onclick="window.close()"><i class="fa fa-eye"></i>&nbsp;'.ls_view.'</a></td>
                    </tr>
                ';
		}else{
			$timeA = $ads_row['adsrice_time'];
            $timeB = date("d.m.Y H:i");
            $timeDiff = strtotime($timeB) - strtotime($timeA);
            if ($timeDiff > $ads_time){
				echo '<tr>
                        <td>'.$ade_row['advertisement_id'].'</td>
                        <td>'.$ade_row['advertisement_title'].'</td>
                        <td><a class="btn btn-success btn-success flat btn-xs" href="/Surf/'.$ade_row['advertisement_base'].'" target="_blank"><i class="fa fa-eye"></i>&nbsp;'.ls_view.'</a></td>
                    </tr>
                ';
			}
			
			
		}
	}
			}
}else{
	while($ade_row = mysql_fetch_assoc($advertisement_query)){
	echo '<tr>
                        <td>'.$ade_row['advertisement_id'].'</td>
                        <td>'.$ade_row['advertisement_title'].'</td>
                        <td><a class="btn btn-success btn-success flat btn-xs" href="/Surf/'.$ade_row['advertisement_base'].'" target="_blank"><i class="fa fa-eye"></i>&nbsp;'.ls_view.'</a></td>
                    </tr>
		';
}
}

?>

 

  • Etiketler;
Cevap Yaz

Cevap yazabilmek için üye girişi yapmanız gerekiyor!

Yukarı Git