function get_cha() { if ($_GET['module'] == 'news') { if (intval($_GET['cha']) > 0) { return intval($_GET['cha']); } elseif (intval($_GET['cat']) > 0) { $cat = new category_news(); $row = $cat->detail($_GET['cat']); return $row['cha_id']; } elseif (intval($_GET['id']) > 0) { $news = new news(); $row = $news->detail('cha_id', $_GET['id']); return $row['cha_id']; } } else { return 0; } }
<?php include_once '../config.php'; if ($_GET['module'] == 'product') { include_once '../class/class_category_pro.php'; $cat = new category_pro(); } else { include_once '../class/class_category_news.php'; $cat = new category_news(); } echo $cat->select(intval($_GET['cha']), intval($_GET['cat']));