当前位置: 首页>>代码示例>>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;未经允许,请勿转载。