i want to show featured ads in slider problem is there is two table have to use to get ads. First one is class_ads that have all info of ad like title, description, price etc and second table is class_ads_pictures from where i have to match id of each ad and get the name of folder and picture name from table ....
Please review my poor logic and teach me
<?php
require_once "include/include.php";
global $db;
global $lng;
$smarty = new Smarty;
$smarty = common($smarty);
$featured_ads = mysql_query("SELECT * FROM class_ads where active=1 and featured=1 limit 50");
while ($tmp = mysql_fetch_array($featured_ads)) {
$ad_id = $temp['id'];
$ad_title = $temp['title'];
//check for image if featured ad have image (Need to fetch only single image)
$featured_ads_images = mysql_query("select from class_ads_pictures where ad_id=$ad_id order by order_no");
$img = mysql_fetch_array($featured_ads_images);
$img_id = $img['id'];
$ad_img = $img['picture'];
$img_folder = $img['folder'];
// Problem is how to assign and what have to assign, to get display in html file ...
}
$smarty->assign('what', $what);
$db->close();
if($db->error!='') { $db_error = $db->getError(); $smarty->assign('db_error',$db_error); }
$smarty->display('header_featured.html');
close();
?>