public function showMessageByPage($fenyePage, $loginname) { $sql = "select *from message where getter = '" . $loginname . "'" . "limit " . $fenyePage->pageSize * ($fenyePage->page - 1) . "," . $fenyePage->pageSize; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql2($sql); return $res; }
function getEmpListByPage($pageNow, $pageSize) { $sql = "select * from emp limit " . ($pageNow - 1) * $pageSize . ",{$pageSize}"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql2($sql); $sqlHelper->close_connect(); return $res; }
public function getStuListByPage($pageNow, $pageSize) { $sql = "select * from student limit " . ($pageNow - 1) * $pageSize . ",{$pageSize}"; $sqlHelper = new SqlHelper(); $res2 = $sqlHelper->execute_dql2($sql); //free return $res2; }
public function updateEmp($id) { $sql = "select * from emp where id={$id}"; $sqlHelper = new SqlHelper(); $arr = $sqlHelper->execute_dql2($sql); $sqlHelper->close_connect(); $emp = new Emp(); $emp->setId($arr['0']['id']); $emp->setName($arr['0']['name']); $emp->setGrade($arr['0']['grade']); $emp->setEmail($arr['0']['email']); //return $arr; return $emp; }
function getMessage($getter, $sender) { $sql = "select * from mes where getter='{$getter}' and sender='{$sender}' and state=0"; $mesXML = "<meses>"; $sqlHelper = new SqlHelper(); $mesList = $sqlHelper->execute_dql2($sql); if (count($mesList) != 0) { for ($i = 0; $i < count($mesList); $i++) { $row = $mesList[$i]; $mesXML .= "<id>{$row['id']}</id><sender>{$row['sender']}</sender><getter>{$row['getter']}</getter><con>{$row['content']}</con><sendTime>{$row['sendTime']}</sendTime>"; } $sql = "update mes set state=1 where getter='{$getter}' and sender='{$sender}'"; $res = $sqlHelper->execute_dml($sql); } $mesXML .= "</meses>"; $sqlHelper->close_connect(); return $mesXML; }
function QueryAllNation() { $sql = "select nationId,nationName from t_Nation"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql2($sql); // 关闭连接 $sqlHelper->close_connect(); return $res; }
function QueryAllStudentInfo() { $sql = "select zkzh,name from t_StudentInfo"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql2($sql); // 关闭连接 $sqlHelper->close_connect(); return $res; }
<?php require_once 'SqlHelper.class.php'; $kefu = $_COOKIE["KEFU"]; set_time_limit(0); $i = 0; $sqlHelper = new SqlHelper(); while (true) { echo $i++ . "</br>"; $sql = "select * from mes where getter='{$kefu}' and state=0 limit 1"; $res = $sqlHelper->execute_dql2($sql); if (!empty($res)) { $sql = "update mes set state=1 where id=" . $res[0]['id']; $sqlHelper->execute_dql($sql); $msg = json_encode($res[0]); echo "<script type='text/javascript'>"; echo "parent.window.comet({$msg});"; echo "</script>"; } ob_flush(); flush(); sleep(1); }
<?php require_once 'SqlHelper.class.php'; $sqlHelper=new SqlHelper(); $arr=$sqlHelper->execute_dql2("select * from empmanage limit 20"); print_r($arr); ?>