Title1

Title2

Title3

12-8 get_creative_nav()

get_creative_nav()


########################################
#取得單筆記錄
########################################
function get_creative_nav($sn = "") {
	global $mysqli;
	if (!$sn) {
		redirect_header("index.php", 3000, "查詢選單資料錯誤!!");
	}

	$sql = "select *
          from `creative_nav`
          where `sn`='{$sn}' and `kind`= 'nav_home'";
	$result = $mysqli->query($sql) or die(printf("Error: %s <br>" . $sql, $mysqli->sqlstate));
	$row = $result->fetch_assoc();

	#過濾撈出資料
	$row['sn'] = intval($row['sn']);
	//http://www.w3school.com.cn/php/func_string_htmlspecialchars.asp
	$row['title'] = htmlspecialchars($row['title'], ENT_QUOTES); // 轉換雙引號和單引號
	$row['url'] = htmlspecialchars($row['url'], ENT_QUOTES); // 轉換雙引號和單引號
	$row['sort'] = intval($row['sort']);
	$row['enable'] = intval($row['enable']);
	$row['target'] = intval($row['target']);

	return $row;
}