当前位置: 首页>>代码示例>>PHP>>正文


PHP DBUtils::insert方法代码示例

本文整理汇总了PHP中DBUtils::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtils::insert方法的具体用法?PHP DBUtils::insert怎么用?PHP DBUtils::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBUtils的用法示例。


在下文中一共展示了DBUtils::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 public static function add($param)
 {
     $pdo = new DBUtils();
     $key_str = "";
     $val_str = "";
     $sql = "";
     if (isset($param['type'])) {
         $key_str .= "type,";
         $val_str .= "'{$param['type']}',";
     }
     if (isset($param['studentName'])) {
         $key_str .= "studentName,";
         $val_str .= "'{$param['studentName']}',";
     }
     if (isset($param['num'])) {
         $key_str .= "num" . ",";
         $val_str .= "'{$param['num']}',";
     }
     $now = time();
     $key_str .= "time" . ",";
     $val_str .= "'{$now}',";
     $key_str .= "course" . ",";
     $val_str .= "'{$GLOBALS['STUDENT_COURSE_TYPE'][0]}',";
     $key_str = substr($key_str, 0, strlen($key_str) - 1);
     $val_str = substr($val_str, 0, strlen($val_str) - 1);
     $sql = "insert into student_news (" . $key_str . ")";
     $sql .= " VALUES (" . $val_str . ")";
     $articleId = $pdo->insert($sql);
     return $articleId;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:30,代码来源:mod_thanks.php

示例2: savePhoto

 public static function savePhoto($param)
 {
     $pdo = new DBUtils();
     $create_time = time();
     $sql = "insert into photo (photoName, photoUrl, create_time)";
     $sql .= " VALUES ('{$param['photoName']}', '{$param['photoUrl']}', '{$create_time}')";
     $rs = $pdo->insert($sql);
     return $rs;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:9,代码来源:mod_index.php

示例3: add

 public static function add($param)
 {
     $pdo = new DBUtils();
     $key_str = "";
     $val_str = "";
     $sql = "";
     if (isset($param['content'])) {
         $key_str .= "content,";
         $val_str .= "'{$param['content']}',";
     }
     if (isset($param['title'])) {
         $key_str .= "title,";
         $val_str .= "'{$param['title']}',";
     }
     if (isset($param['snavId'])) {
         $key_str .= "snavId" . ",";
         $val_str .= "'{$param['snavId']}',";
     }
     if (isset($param['smallContent'])) {
         $key_str .= "smallContent" . ",";
         $val_str .= "'{$param['smallContent']}',";
     }
     if (isset($param['articleImg'])) {
         $key_str .= "articleImg" . ",";
         $val_str .= "'{$param['articleImg']}',";
     }
     $now = time();
     $key_str .= "time" . ",";
     $val_str .= "'{$now}',";
     $key_str = substr($key_str, 0, strlen($key_str) - 1);
     $val_str = substr($val_str, 0, strlen($val_str) - 1);
     $sql = "insert into article (" . $key_str . ")";
     $sql .= " VALUES (" . $val_str . ")";
     $articleId = $pdo->insert($sql);
     return $articleId;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:36,代码来源:mod_article.php

示例4: saveJoinus

 public static function saveJoinus($param)
 {
     $pdo = new DBUtils();
     $key_str = "";
     $val_str = "";
     $sql = "";
     if (isset($param['bus_name'])) {
         $key_str .= "bus_name,";
         $val_str .= "'{$param['bus_name']}',";
     }
     if (isset($param['address'])) {
         $key_str .= "address,";
         $val_str .= "'{$param['address']}',";
     }
     if (isset($param['phone'])) {
         $key_str .= "phone" . ",";
         $val_str .= "'{$param['phone']}',";
     }
     if (isset($param['email'])) {
         $key_str .= "email" . ",";
         $val_str .= "'{$param['email']}',";
     }
     if (isset($param['others'])) {
         $key_str .= "others" . ",";
         $val_str .= "'{$param['others']}',";
     }
     $now = time();
     $key_str .= "time" . ",";
     $val_str .= "'{$now}',";
     $key_str = substr($key_str, 0, strlen($key_str) - 1);
     $val_str = substr($val_str, 0, strlen($val_str) - 1);
     $sql = "insert into joinus (" . $key_str . ")";
     $sql .= " VALUES (" . $val_str . ")";
     $id = $pdo->insert($sql);
     return $id;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:36,代码来源:mod_buy.php

示例5: addCourse

 public static function addCourse($param)
 {
     $pdo = new DBUtils();
     $key_str = "";
     $val_str = "";
     $sql = "";
     if (isset($param['courseId'])) {
         $key_str .= "courseId,";
         $val_str .= "'{$param['courseId']}',";
     }
     if (isset($param['courseName'])) {
         $key_str .= "courseName,";
         $val_str .= "'{$param['courseName']}',";
     }
     $key_str = substr($key_str, 0, strlen($key_str) - 1);
     $val_str = substr($val_str, 0, strlen($val_str) - 1);
     $sql = "insert into course (" . $key_str . ")";
     $sql .= " VALUES (" . $val_str . ")";
     $courseId = $pdo->insert($sql);
     return $courseId;
 }
开发者ID:zcmyworld,项目名称:nothing,代码行数:21,代码来源:mod_course.php


注:本文中的DBUtils::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。