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


PHP DbHelper::insert方法代碼示例

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


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

示例1: DbHelper

<?php

/* TODO: Add code here */
require_once '../lib/global.php';
$conn = new DbHelper("pg_newsclass");
$id = $_GET['id'];
$type = $_GET['type'];
$name = mysql_escape_string(stripslashes($_GET['name']));
if ($_GET['type'] == 1) {
    $conn->update($id, "name='{$name}'");
}
if ($_GET['type'] == 2) {
    if ($conn->delete($id) > 0) {
        echo "true";
    } else {
        echo "false";
    }
}
if ($_GET['type'] == 3) {
    $conn->insert('name', "'{$name}'");
}
echo "OK!";
echo "<script type='text/javascript' src='../js/common.js'></script><script>GotoOtherPage('EditNewsType.php','遊戲類型修改成功!')</script>";
開發者ID:yunsite,項目名稱:nadcmajinphpgame,代碼行數:23,代碼來源:Edit_Del_NewsType.php

示例2: save

 /**
  * Save the rectangle into the database
  */
 public function save()
 {
     return $this->isValid() && DbHelper::insert(array(self::DB_COL_TOP_A => (int) $this->topA, self::DB_COL_LEFT_A => (int) $this->leftA, self::DB_COL_TOP_B => (int) $this->topB, self::DB_COL_LEFT_B => (int) $this->leftB), self::DB_TABLE);
 }
開發者ID:BenSotty,項目名稱:drawer,代碼行數:7,代碼來源:Rectangle.class.php

示例3: DbHelper

<body>
<?php 
require_once '../lib/global.php';
$content = mysql_escape_string(stripslashes($_POST['FCKeditor1']));
$title = mysql_escape_string(stripslashes($_POST['title']));
$author = mysql_escape_string(stripslashes($_POST['author']));
$clazz = mysql_escape_string(stripslashes($_POST['clazz']));
$tags = mysql_escape_string(stripslashes($_POST['tag']));
$clicktimes = mysql_escape_string(0);
$commentnum = mysql_escape_string(0);
$scores = mysql_escape_string(0);
$addtime = mysql_escape_string(date("Y-m-d H:i:s"));
$picurl = mysql_escape_string('testurl');
$newsDbHelper = new DbHelper("pg_news");
$newsDbHelper->insert('title,content,classid,date,picurl,tags,author,clicktimes,commentnum,scores', "'{$title}','{$content}','{$clazz}','{$addtime}','{$picurl}','{$tags}','{$author}','{$clicktimes}','{$commentnum}','{$scores}'");
echo "<script type='text/javascript' src='../js/common.js'></script><script>GotoOtherPage('addnews.php','添加新聞成功!')</script>";
/*echo "<script>alert('新聞內容是:$sValue')</script>";
echo "<script>alert('新聞標題是:$title')</script>";*/
?>
</body>
開發者ID:yunsite,項目名稱:nadcmajinphpgame,代碼行數:20,代碼來源:setaddnews.php


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