sql_query("SELECT * FROM `home` where id=1"); $home_elements=$db->fetch(); $db->sql_query("select max(id) from questions where `show` = 1"); $tmp=$db->fetch(); $max_id = $tmp['max(id)']; $db->sql_query("SELECT * FROM questions, answers where questions.id = ".$max_id." AND questions.id=answers.q_id"); $question=$db->fetch(); $smarty->clear_all_assign(); $smarty->assign("picpath",PIC_PATH); $smarty->assign('home_elements',$home_elements); $smarty->assign('main_title',$main_title); $smarty->assign('question',$question); print ""; $smarty->display( TPL_NAME .".html"); ?>