本文整理汇总了PHP中SqlHelper::execute_dql方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlHelper::execute_dql方法的具体用法?PHP SqlHelper::execute_dql怎么用?PHP SqlHelper::execute_dql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlHelper
的用法示例。
在下文中一共展示了SqlHelper::execute_dql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ChangePassword
public function ChangePassword($username, $oldPassword, $newPassword)
{
$result = false;
$sql = "select password from t_admin where username='{$username}'";
//创建一个SqlHelper对象
$sqlHelper = new SqlHelper();
$res = $sqlHelper->execute_dql($sql);
if ($row = mysql_fetch_assoc($res)) {
//比对密码
if (md5($oldPassword) == $row['password']) {
$sql = "update t_admin set password='" . md5($newPassword) . "' where username='{$username}'";
if ($sqlHelper->execute_dml($sql) != 0) {
$result = true;
} else {
$this->errMessage = "更新失败!";
}
} else {
$this->errMessage = "原始密码不正确";
}
}
//资源
mysql_free_result($res);
//关闭链接
$sqlHelper->close_connect();
return $result;
}
示例2: getEmpListByPage
function getEmpListByPage($pageNow, $pageSize)
{
$strNum = ($pageNow - 1) * $pageSize;
$sql = "select * from emp limit {$strNum},{$pageSize}";
$sqlHelper = new SqlHelper();
$re = $sqlHelper->execute_dql($sql);
// $sqlHelper->close_conn();
return $re;
}
示例3: getPageCount
public function getPageCount($pageSize)
{
$sql = "select count(id) from student";
$sqlHelper = new SqlHelper();
$res = $sqlHelper->execute_dql($sql);
//calcute
if ($row = mysql_fetch_row($res)) {
$pageCount = ceil($row[0] / $pageSize);
}
//free
return $pageCount;
}
示例4: checkAdmin
public function checkAdmin($id, $password)
{
$sql = "select password,name from admin where id={$id}";
$sqlhelper = new SqlHelper();
$res = $sqlhelper->execute_dql($sql);
if ($row = mysqli_fetch_assoc($res)) {
if (md5($password) == $row['password']) {
return true;
}
}
mysqli_free_result($res);
$sqlhelper->close_conn();
return false;
}
示例5: getPagecount
public function getPagecount($pagesize)
{
$sql = "select count(id) from emp";
$sqlHelper = new SqlHelper();
$res = $sqlHelper->execute_dql($sql);
if ($row = mysql_fetch_row($res)) {
$pagecount = ceil($row[0] / $pagesize);
}
//关闭资源
mysql_free_result($res);
//关闭连接
$sqlHelper->close_connect();
return $pagecount;
}
示例6: getPageCount
function getPageCount($pageSize)
{
//查询rowcout
$sql = "select count(id) from brand_wyeth_customer";
$sqlhelper = new SqlHelper();
$res = $sqlhelper->execute_dql($sql);
//计算pagecount
if ($row = mysql_fetch_row()) {
$pagecount = ceil($row[0] / $pageSize);
}
//释放资源关闭链接
mysql_free_result($res);
mysql_close();
return $pagecount;
}
示例7: getPageCount
function getPageCount($pageSize)
{
//需要查询$rowCount
$sql = "select count(id) from emp";
$sqlHelper = new SqlHelper();
$res = $sqlHelper->execute_dql($sql);
//这样就可以计算$pageCount
if ($row = mysql_fetch_row($res)) {
$pageCount = ceil($row[0] / $pageSize);
}
//释放资源关闭链接
mysql_fetch_row($res);
$sqlHelper->close_connect();
return $pageCount;
}
示例8: checkAdmin
public function checkAdmin($id, $password)
{
$sql = "select password,name from userlogin where id={$id}";
$sqlHelper = new SqlHelper();
$res = $sqlHelper->execute_dql($sql);
if ($row = mysql_fetch_assoc($res)) {
if (md5($password) == $row['password']) {
return $row['name'];
}
}
//关闭资源
mysql_free_result($res);
//关闭连接
$sqlHelper->close_connect();
return "";
}
示例9: chekcAdimn
public function chekcAdimn($id, $password)
{
$sql = "select password,name from admin where id={$id}";
//创建一个SqlHelper对象
$sqlHelper = new SqlHelper();
$res = $sqlHelper->execute_dql($sql);
if ($row = mysql_fetch_assoc($res)) {
//比对密码
if (md5($password) == $row['password']) {
return $row['name'];
}
}
//释放资源
mysql_free_result($res);
//关闭链接
$sqlHelper->close_connect();
return "";
}
示例10: checkAdmin
public function checkAdmin($id, $password)
{
$sql = "select password,name from admin where id={$id}";
//????SqlHelper??
$sqlHelper = new SqlHelper();
$res = $sqlHelper->execute_dql($sql);
if ($row = mysql_fetch_assoc($res)) {
//????
if (md5($password) == $row['password']) {
return $row['name'];
}
}
//????
mysql_free_result($free);
//????
$sqlHelper->close_connect();
return false;
}
示例11: getMessage
function getMessage($getter, $sender)
{
$sql = "select * from messages where getter='{$getter}' and sender='{$sender}' and isGet=0";
//注意此处的sql语句中sender=“$getter”;是加引号的
//file_put_contents("C:/wamp/www/testinfo.log","sql=".$sql."\r\n", FILE_APPEND);
$sqlhelper = new SqlHelper();
$array = $sqlhelper->execute_dql($sql);
//dql返回的是数组
$mesInfo = "<mes>";
for ($i = 0; $i < count($array); $i++) {
$row = $array[$i];
$mesInfo .= " <mesId>{$row['id']}</mesId>\n\t\t\t\t\t\t <sender>{$row['sender']}</sender>\n\t\t\t\t\t\t <getter>{$row['getter']}</getter>\n\t\t\t\t\t\t <content>{$row['content']}</content>\n\t\t\t\t\t\t <sendTime>{$row['sendTime']}</sendTime>";
}
$mesInfo .= "</mes>";
$sqll = "update messages set isGet=1 where getter='{$getter}' and sender='{$sender}'";
// file_put_contents("C:/wamp/www/testinfo.log","sql=".$sql."\r\n", FILE_APPEND);
$sqlhelper->execute_dml($sqll);
//file_put_contents("C:/wamp/www/testinfo.log", $mesInfo."\r\n",FILE_APPEND);
$sqlhelper->close_connect();
return $mesInfo;
}
示例12: SqlHelper
$sqlHelper = new SqlHelper();
echo '<div class="header" style="height: 50px; position: absolute; background-color: black; width: 100%;">
<a href="javascript:" class="user" target="contentFrame" style="float:right; margin-right:20px; margin-top:-1px; "><img src="images/user.png" title="用户设置" ></a>
<a href="api/search.php" target="contentFrame" style="float:right; margin-right:10px; "><img src="images/search15.png" title="搜索"></a>
<span style="float:right; font-size:13px; margin-top:25px; margin-right:25px;">欢迎,';
echo $username;
echo '!</span>
</div>
<div class="container demo-1">
<div class="column">';
for ($j = 1; $j <= 6; $j++) {
for ($m = 1; $m <= 6; $m++) {
$sql = "select id,name from sys where jizu={$j} and mainsys={$m}";
$res[$j][$m] = $sqlHelper->execute_dql($sql);
$row_cnt[$j][$m] = $res[$j][$m]->num_rows;
$height[$j][$m] = ($row_cnt[$j][$m] / 4 + 2) * 50;
}
}
for ($m = 7; $m <= 9; $m++) {
$sql = "select id,name from sys where jizu=7 and mainsys={$m}";
$res[7][$m] = $sqlHelper->execute_dql($sql);
$row_cnt[7][$m] = $res[7][$m]->num_rows;
$height[7][$m] = ($row_cnt[7][$m] / 4 + 2) * 50;
}
echo "<div id='dl-menu' class='dl-menuwrapper'>\n\t\t\t\t<button class='dl-trigger'>Open Menu</button>\n\t\t\t\t<ul class='dl-menu'>";
//1号机
echo "<li>\n\t\t\t\t\t\t<a href='#'>1号机</a>\n\t\t\t\t\t\t<ul class='dl-submenu'>\n\t\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t\t<a href='#'>1号锅炉</a>\n\t\t\t\t\t\t\t\t<ul class='dl-submenu' style='width:1000px; height:";
print $height[1][1];
echo "px;'>";
示例13: realpath
<body>
<?php
$file_to_require = realpath('api/SqlHelper.class.php');
//require "api/SqlHelper.class.php";
require_once $file_to_require;
//header("content-type:text/html;charset=utf-8");
$eid = $_GET['eid'];
//echo $e_sys;
$sqlHelper = new SqlHelper();
$sql_bp = "select * from beipin where eid={$eid}";
$sql_title = "select * from equipments where id={$eid}";
$sql_sg = "select * from shigu where eid={$eid}";
//$sql_lbj="select * from lingbujian where eid=$eid";
$res = $sqlHelper->execute_dql($sql_bp);
$res_title = $sqlHelper->execute_dql($sql_title);
$res_sg = $sqlHelper->execute_dql($sql_sg);
//$res_lbj= $sqlHelper->execute_dql($sql_lbj);
$title = $res_title->fetch_row();
echo '
<div>
<a href="equipment.php?sys=' . $title[2] . '" style="font-size:10px; " ><<返回列表</a>
<h2>';
echo $title[1];
echo '</h2>
</div>
<div class="nTab">
<!-- 标题开始 -->
<div class="TabTitle">
示例14: exportExcel
$eid = $xls->sheets[0]['cells'][$i][4];
$data_values .= "('{$name}','{$type}',{$num},{$eid}),";
}
$data_values = substr($data_values, 0, -1);
//去掉最后一个逗号
$query = $sqlHelper->execute_dml("insert into beipin (name,type,num,eid) values {$data_values}");
//批量插入数据表中
if ($query) {
echo '导入成功!';
} else {
echo '导入失败!';
}
}
} elseif ($action == 'export') {
//导出XLS
$result = $sqlHelper->execute_dql("select * from student");
$str = "姓名\t性别\t年龄\t\n";
$str = iconv('utf-8', 'gb2312', $str);
while ($row = $result->fetch_array()) {
$name = iconv('utf-8', 'gb2312', $row['name']);
$sex = iconv('utf-8', 'gb2312', $row['sex']);
$str .= $name . "\t" . $sex . "\t" . $row['age'] . "\t\n";
}
$filename = date('Ymd') . '.xls';
exportExcel($filename, $str);
}
function exportExcel($filename, $content)
{
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-execl");
header("Content-Type: application/force-download");
示例15: while
<table class="sTab" style="margin:20 auto;" >
<tr>
<td>
<select name="catalog" style="line-height:30px; font-size:20px;">
<option>请选择</option>
<option value="4">设备</option>
<option value="1">备品备件</option>
<option value="2">异动单</option>
<option value="3">模拟单</option>
</select>
</td>
<td><input type="text" name="name" size="50" style="line-height:30px; font-size:20px;" /></td>
<td><input type="submit" value="搜索" class="searchBtn" style="line-height:30px; font-size:20px;"></td></tr>';
$sqlrecent = "SELECT * FROM recentsearch ORDER BY id DESC LIMIT 5";
$res = $sqlHelper->execute_dql($sqlrecent);
$row_cnt = $res->num_rows;
if ($row_cnt != 0) {
echo "<tr><td colspan='3'>最近搜索:";
while ($row = $res->fetch_array()) {
echo "<a href='searchpages.php?name=" . $row['name'] . "&catalog=" . $row['catalog'] . "'>" . $row['name'] . "</a> ";
}
echo "</td></tr>";
}
echo '</table>
</div>
</form>';
/*
if(isset($_POST['name'])){
$name=$_POST['name'];