$_GET['name'], "catalog1" => $_GET['catalog1'], "catalog2" => $_GET['catalog2'], "style" => $_GET['style'], "city" => $_GET['city'], "material" => $_GET['material'], "season" => $_GET['season'], "juice" => $_GET['juice'], "formular" => $_GET['formular'], "hints" => $_GET['hints'], "last_update" => $_GET['last_update'] ); //query section $sql="select id, name, catalog1, catalog2, last_update from recipe"; $i=0; foreach($input as $key => $value) { if ($value != "") { if ($i==0) { $sql.=" where"; $i=1; } else { $sql.=" and"; } } if ($key == "name" or $key== "city" or $key=="material" or $key=="season" or $key=="juice" or $key=="formular" or $key=="hints") { if ($value!= "") { $sql.=" $key like '%$value' or $key like '%$value%' or $key like '$value%'"; } } if ($key == "catalog1" or $key == "catalog2" or $key == "style") { if ($value != "") { $sql.=" $key = '".$word[$key][$value]."'"; } } } if ($_GET['keyword']!= "") { $i=0; foreach ($word['sort'] as $fieldname) { if ($i==0) { $sql.=" where"; $i=1; } else { $sql.=" and"; } $sql.=" $fieldname like '%$_GET[keyword]'"; $sql.=" or $fieldname like '%$_GET[keyword]%'"; $sql.=" or $fieldname='$_GET[keyword]%'"; } } $result= $db->dbQuery($sql); $total = $db->getRows($result); //paging section //paging config //define the rows and cols in a table $rows = 10; $cols = 1; //parameter 1: total records, parameter 2: rows per page, parameter 3: cols per rows $p = new Paging($total, $rows, $cols); //set request page $p->setRequestPage($_REQUEST["page"]); //getCurrentPage $page = $p->getCurrentPage(); //get start index of the records $index = $p->getStartIndex(); if ($_GET['sort']!= "") { $sql.=" order by ".$word['sort'][$_GET['sort']]." ".$_GET['order']; } $sql.=" limit $index, 10"; //echo $sql; $result= $db->dbQuery($sql); //get records $record = $db->getRecords($result); //close connection $db->disconnect(); //display........... //get data $data = array(); for ($i=0;$i $record[$i]['id'], "name" => $record[$i]['name'], "catalog1" => $record[$i]['catalog1'], "catalog2" => $record[$i]['catalog2'], "last_update" => $record[$i]['last_update']); } //end for //header $tpl->assign("total_no", $total); $tpl->assign("page_links", $p->pagingMenu()); $tpl->display("result_header.html"); //body section $tpl->assign("record", $data); $tpl->display("result_body.html"); //footer $tpl->assign("page_links", $p->pagingMenu()); $tpl->display("result_footer.html"); ?>