execute_dql2() public method

执行dql语句,但是返回的是一个数组
public execute_dql2 ( $sql )
コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
ファイル: MessageService.class.php プロジェクト: hnqing/xiahn
 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;
 }
コード例 #6
0
 function QueryAllNation()
 {
     $sql = "select nationId,nationName from t_Nation";
     $sqlHelper = new SqlHelper();
     $res = $sqlHelper->execute_dql2($sql);
     // 关闭连接
     $sqlHelper->close_connect();
     return $res;
 }
コード例 #7
0
 function QueryAllStudentInfo()
 {
     $sql = "select zkzh,name from t_StudentInfo";
     $sqlHelper = new SqlHelper();
     $res = $sqlHelper->execute_dql2($sql);
     // 关闭连接
     $sqlHelper->close_connect();
     return $res;
 }
コード例 #8
0
ファイル: cometbyiframe.php プロジェクト: hnqing/xiahn
<?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);
}
コード例 #9
0
ファイル: test.php プロジェクト: uhgy/phppractice
<?php

	require_once 'SqlHelper.class.php';

	$sqlHelper=new SqlHelper();
	$arr=$sqlHelper->execute_dql2("select * from empmanage limit 20");
	print_r($arr);

?>