當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SqlHelper::execute_dml方法代碼示例

本文整理匯總了PHP中SqlHelper::execute_dml方法的典型用法代碼示例。如果您正苦於以下問題:PHP SqlHelper::execute_dml方法的具體用法?PHP SqlHelper::execute_dml怎麽用?PHP SqlHelper::execute_dml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SqlHelper的用法示例。


在下文中一共展示了SqlHelper::execute_dml方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addMessage

function addMessage($sender,$getter,$con) {
//創建SQL語句
$sql="insert into messages (sender,getter,content,sendTime) values('$sender','$getter','$con',now())";
file_put_contents("/Library/WebServer/Documents/ajax/mylog.txt",$sql."\r", FILE_APPEND);
$sqlHelper=new SqlHelper();
 return $sqlHelper->execute_dml($sql);
}
開發者ID:huang303513,項目名稱:WebDevelopStudy,代碼行數:7,代碼來源:MessageService.class.php

示例2: 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;
 }
開發者ID:otkinlife,項目名稱:MyPhalcon,代碼行數:26,代碼來源:AdminService.class.php

示例3: DeleteNation

 function DeleteNation($nationId)
 {
     $sql = "delete from t_Nation where nationId={$nationId}";
     // 創建SqlHelper對象實例執行刪除
     $sqlHelper = new SqlHelper();
     return $sqlHelper->execute_dml($sql);
 }
開發者ID:otkinlife,項目名稱:MyPhalcon,代碼行數:7,代碼來源:NationService.class.php

示例4: adduser

 public function adduser($name, $grade, $email, $score)
 {
     $sql = "insert into student(name,grade,email,score)values('{$name}','{$grade}',{$email},{$score})";
     $sqlHelper = new SqlHelper();
     $res = $sqlHelper->execute_dml($sql);
     $sqlHelper->close_connect;
     return $res;
 }
開發者ID:EricWenyi,項目名稱:Member-Management-System,代碼行數:8,代碼來源:StuService.class.php

示例5: updateEmpUI

 public function updateEmpUI($id, $name, $grade, $email)
 {
     $sql = "update emp set name='{$name}',grade={$grade},email='{$email}' where id={$id}";
     $sqlHelper = new SqlHelper();
     $res = $sqlHelper->execute_dml($sql);
     $sqlHelper->close_connect();
     return $res;
 }
開發者ID:jimmyZRone,項目名稱:test-ssh-key,代碼行數:8,代碼來源:empService.class.php

示例6: getMessage

 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;
 }
開發者ID:hnqing,項目名稱:xiahn,代碼行數:18,代碼來源:MessageService.class.php

示例7: 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;
 }
開發者ID:flyweiing,項目名稱:chatroom,代碼行數:21,代碼來源:MessageService.class.php

示例8: SqlHelper

<?php

require_once 'SqlHelper.class.php';
require_once 'valiuser.php';
checkUserValidate();
header("content-type:text/html;charset=utf-8");
$id = $_POST['id'];
$val = $_POST['value'];
//echo $id;
//echo $val;
$sqlHelper = new SqlHelper();
$sql = "update beipin set olnum={$val} where id={$id}";
//if(empty($val)){
//	echo "不能為空";
//}else{
$b = $sqlHelper->execute_dml($sql);
if ($b == 1) {
    echo $val;
} else {
    echo "修改失敗";
}
//}
開發者ID:lampdhp,項目名稱:ledger-manager,代碼行數:22,代碼來源:oledit.php

示例9: DeleteStudentInfo

 function DeleteStudentInfo($zkzh)
 {
     $sql = "delete from t_StudentInfo where zkzh='{$zkzh}'";
     // 創建SqlHelper對象實例執行刪除
     $sqlHelper = new SqlHelper();
     return $sqlHelper->execute_dml($sql);
 }
開發者ID:otkinlife,項目名稱:MyPhalcon,代碼行數:7,代碼來源:StudentInfoService.class.php

示例10: Useraddemp

 function Useraddemp($id, $name, $password)
 {
     //做一個$sql語句
     $sql = "insert into admin (id,name,password) values('{$id}','{$name}',md5('{$password}'))";
     //同sqlHelper完成添加
     $sqlHelper = new SqlHelper();
     $res = $sqlHelper->execute_dml($sql);
     $sqlHelper->close_connect();
     return $res;
 }
開發者ID:enmeen,項目名稱:git_empManage,代碼行數:10,代碼來源:EmpService.class.php

示例11: sys

			<td><input type="submit" value="顯示" class="editBtn" name="edit"></td>
			</tr></table>
			</div>
			</form>';
if (isset($_POST)) {
    if (isset($_POST['add'])) {
        $name = $_POST['name'];
        $addjizu = $_POST['addjizu'];
        $addm_sys = $_POST['addsys'];
        //echo $name.$addjizu.$addm_sys;
        //添加係統
        if ($name == null) {
            echo "名稱不能為空";
        } else {
            $sqladd = "insert into sys (name,jizu,mainsys) values ('{$name}','{$addjizu}','{$addm_sys}')";
            $b = $sqlHelper->execute_dml($sqladd);
            if ($b == 1) {
                echo "添加成功";
            } else {
                echo "添加失敗";
            }
        }
    } else {
        if (isset($_POST['edit'])) {
            $jizu = $_POST['jizu'];
            $m_sys = $_POST['sys'];
            $sql = "select * from sys where jizu={$jizu} and mainsys={$m_sys}";
            $res = $sqlHelper->execute_dql($sql);
            //$row_cnt=$res->num_rows ;
            $i = 1;
            //$row_cnt = $res -> num_rows;
開發者ID:lampdhp,項目名稱:ledger-manager,代碼行數:31,代碼來源:sysManager.php

示例12: date

    $save_path = "xls/";
    $file_name = $save_path . date('Ymdhis') . ".xls";
    if (copy($tmp, $file_name)) {
        $xls = new Spreadsheet_Excel_Reader();
        $xls->setOutputEncoding('utf-8');
        $xls->read($file_name);
        for ($i = 2; $i <= $xls->sheets[0]['numRows']; $i++) {
            $name = $xls->sheets[0]['cells'][$i][1];
            $type = $xls->sheets[0]['cells'][$i][2];
            $num = $xls->sheets[0]['cells'][$i][3];
            $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']);
開發者ID:lampdhp,項目名稱:ledger-manager,代碼行數:31,代碼來源:do.php

示例13: recentsearch

			 
			 <td><input type="submit" value="搜索" class="searchBtn" style="line-height:30px; font-size:20px;"></td></tr>

			</table>
			</div>
			</form>';
if (isset($_REQUEST['name'])) {
    $name = $_REQUEST['name'];
    $c = $_REQUEST['catalog'];
    $pageSize = 12;
    if ($name == null) {
        echo "<div style='text-align:center; color:red;'>請輸入需要查詢的內容</div>";
    } else {
        //插入到最近查詢列表
        $sqlinsert = "insert into recentsearch (name,catalog) values ('{$name}','{$c}')";
        $b = $sqlHelper->execute_dml($sqlinsert);
        if ($c == 1) {
            //查找備品
            if (isset($_GET['page'])) {
                $page = intval($_GET['page']);
            } else {
                $page = 1;
            }
            //獲取分頁
            $offset = $pageSize * ($page - 1);
            $prepage = $page - 1;
            $nextpage = $page + 1;
            //獲得所有結果列數
            $sqlcnt1 = "select count(*) from beipin where name like '%{$name}%'";
            $rescnt1 = $sqlHelper->execute_dql($sqlcnt1);
            $cntrow1 = $rescnt1->fetch_array();
開發者ID:lampdhp,項目名稱:ledger-manager,代碼行數:30,代碼來源:searchpages.php

示例14: delEmpById

		function delEmpById($id){
			$sqlHelper=new SqlHelper();
			$sql="delete from empmanage where id=$id";
			$sqlHelper->execute_dml($sql);

		}
開發者ID:uhgy,項目名稱:phppractice,代碼行數:6,代碼來源:EmpService.class.php

示例15:

			<tr><td>請重新輸入:</td><td><input type="password" name="renewpwd" size="30" /><span style="color:red;">*</span></td></tr>
			<tr><td colspan="2" align="right" ><input type="submit" value="確定" class="addBtn"><a href="user.php" style="text-decoration:none; color:black; font-size:11px; padding-left:5px;">返回</a></td></tr>
			</table>
			
			</form>';
if ($_POST) {
    $oldpwd = md5($_POST['oldpwd']);
    $newpwd = md5($_POST['newpwd']);
    $renewpwd = md5($_POST['renewpwd']);
    if ($oldpwd == "" || $newpwd == "" || $renewpwd == "") {
        echo "密碼不能為空";
    } else {
        if (!($newpwd == $renewpwd)) {
            echo "兩次輸入必須相同";
        } else {
            //取出舊密碼
            $sql = "select pwd from users where id = {$uid}";
            $res = $sqlHelper->execute_dql($sql);
            $row = $res->fetch_array();
            if ($row['pwd'] == $oldpwd) {
                $sqlupdate = "update users set pwd='{$newpwd}' where id={$uid}";
                $b = $sqlHelper->execute_dml($sqlupdate);
                if ($b == 1) {
                    echo "修改成功,請關閉或返回";
                } else {
                    echo "修改失敗";
                }
            }
        }
    }
}
開發者ID:lampdhp,項目名稱:ledger-manager,代碼行數:31,代碼來源:changepwd.php


注:本文中的SqlHelper::execute_dml方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。