Hi Masters of Web Programing. I've got this code:
<?PHP
$db_user = 'user';
$db_pass = 'password';
$db_name = 'dbname';
$db_host = 'localhost';
if(mysql_connect($db_host,$db_user,$db_pass)) {
mysql_select_db($db_name);
mysql_query("CREATE TABLE IF NOT EXISTS smsads(id bigint unsigned primary key auto_increment, link varchar(255), fromnum varchar(60))");
$res = mysql_query("SELECT * FROM smsads ORDER BY id DESC LIMIT 36");
while($row = mysql_fetch_object($res)) {
if ($res>=36){
$http_link = $row->link;
$root_link = strpos($http_link, '/');
if ($root_link !== false) {
$before = substr($http_link, 0, $root_link);
}
echo "<div id=\"banner\"><a href=\"http://{$before}\" alt=\"{$before}\" title=\"{$before}\" target=\"_blank\"><img src=\"http://{$http_link}\" /></a></div>";
}
else {
echo $res . "<div id=\"banner\"></div>";
}
}
}
?>
</div>
As we can see, the number of fetched rows are limited to 36. How to make if rows are smaller than 36, to show the existing ones plus adding something else for each one until 36? For example this is a script for pixel advertisement, and I want to visualize the existing pixels (for example, I have 20 inserted pixels), and to show empty boxes into other places that are empty (total 36 places - 20 already placed items = 16 empty places) until the count reaches total 36 boxes.
Gördüğünüz gibi, ben "başka", "If" ile denedim, ama her zaman (ben SONUÇLARI + boş kutular göstermek için bunu söylemek nasıl bilmiyorum, kendisin) sadece boş kutuları gösterir ...