query($sSQL); return $GLOBALS['db']->affectedRows(); } /*================= SQL UPDATE =================*/ function sqlupdate($table,$arr_data,$where="") { if(is_array($arr_data)){ while(list($f,$v) = each($arr_data)){ $list_set .= $f."='".addslashes($v)."',"; } $list_set = substr($list_set,0,strlen($list_set)-1); } else { $list_set = $arr_data; // string } $sSQL = "UPDATE ".$table." SET $list_set " ."\n ".($where?"WHERE ".$where:""); //echo $sSQL; //exit(); $result = $GLOBALS['db']->query($sSQL); return $GLOBALS['db']->affectedRows(); } /*================= Page =================*/ function paging($sql,$url,$PageNo,$PageSize,$Pagenumber) { if($PageNo=="") { $StartRow = 0; $PageNo = 1; } else $StartRow = ($PageNo - 1) * $PageSize; //Set the counter start if($PageNo % $Pagenumber == 0) $CounterStart = $PageNo - ($Pagenumber - 1); else $CounterStart = $PageNo - ($PageNo % $Pagenumber) + 1; $CounterEnd = $CounterStart + $Pagenumber; $TRecord = $GLOBALS['db']->query($sql); $sql.= " LIMIT $StartRow, $PageSize"; $result = $GLOBALS['db']->query($sql); $RecordCount = $TRecord->numRows(); if($RecordCount % $PageSize == 0) $MaxPage = $RecordCount / $PageSize; else $MaxPage = ceil($RecordCount / $PageSize); $gotopage=""; if($MaxPage>1) { if($CounterStart != 1) { $PrevStart = $PageNo - 1; $gotopage.=" «« "; $gotopage.="  «  "; } $c = 0; //Print Page No for($c=$CounterStart;$c<=$CounterEnd;$c++){ if($c <= $MaxPage) if($c == $PageNo) $gotopage.= "$c"; else $gotopage.=" $c "; } if($CounterEnd < $MaxPage){ $NextPage = $PageNo + 1; $gotopage.="  »  "; } //Print Last link if necessary if($CounterEnd < $MaxPage) $gotopage.= " »» "; } $arr[0]=$result; $arr[1]=$gotopage; $arr[2]=$MaxPage; $arr[3]=$RecordCount; return $arr; } ?>
Contact us
     
  Full name *
  Address *
  Phone *
  Email *
  Company
  Subject *
  Content *
 
  Confirmation code *