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


PHP obj::insert方法代码示例

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


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

示例1: add

 /**
  * 添加类别
  *
  * @param array $data 类别信息数组
  */
 public function add(array $data)
 {
     $node['cate_name'] = $data['cate_name'];
     $node['parent_id'] = $data['parent_id'];
     $node['sort_order'] = $data['sort_order'];
     $node['is_show'] = $data['is_show'];
     if (!empty($data['cate_id'])) {
         // 导入数据需要设定id
         $node['cate_id'] = $data['cate_id'];
     }
     $this->db->insert('category', $node);
     $lastId = $this->db->lastInsertId();
     // 更新路径信息
     $path = $this->getPath($node['parent_id']) . "{$lastId};";
     $where = $this->db->quoteInto('cate_id = ?', $lastId);
     $this->db->update('category', array('path' => $path), $where);
     $this->_allCates = null;
 }
开发者ID:BGCX261,项目名称:zhongyycode-svn-to-git,代码行数:23,代码来源:Cate.php

示例2: insert

            echo "Database Connection Error! " . $e->getMessage();
        }
    }
    public function insert($table_name, $form_data = NULL)
    {
        $fields = implode(',', array_keys($form_data));
        $value = implode(',', array_fill(0, count($form_data), '?'));
        $sth = $this->conn->prepare("INSERT INTO {$table_name} ({$fields}) VALUES ({$value})");
        $sth->execute(array_values($form_data));
        return true;
    }
}
$obj = new obj();
$code = substr(md5(rand()), 0, 45);
if (isset($_POST['submit'])) {
    $to = $_POST['email'];
    $subject = 'the subject';
    $message = 'http://raymund.com/lectureclip/resetpass.php?d=' . $code;
    $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    $data = array('gen_code' => $code);
    $obj->insert("tbl_forgot_pass_log ", $data);
    mail($to, $subject, $message, $headers);
    echo 'send';
}
?>

<form action="" method="post">
    <input type="text" name="email">
    <input type="submit" name="submit">
</form>
开发者ID:raymundcuizon,项目名称:lectureclip,代码行数:30,代码来源:forgotpass.php

示例3: saveFBdetails

function saveFBdetails()
{
    $obj = new obj();
    $data = false;
    $_SESSION['fb_login'] = true;
    $_SESSION['fb_lastname'] = $_POST['fb_lastname'];
    $_SESSION['fb_firstname'] = $_POST['fb_firstname'];
    $_SESSION['fb_email'] = $_POST['fb_email'];
    $_SESSION['fb_pic'] = $_POST['fb_pic'];
    //CHECK IF EMAIL EXISTS
    $checkUser = $obj->singleData($_SESSION['fb_email'], "email", "tbl_ut_pass");
    if ($checkUser != NULL) {
        extract($checkUser);
        //IF ALREADY HAVE LC ACCOUNT
        if ($usertype == 1) {
            $usertype = 3;
            $fb_update = array('usertype' => $usertype);
            $obj->update('tbl_ut_pass', $fb_update, "WHERE uid = " . $uid);
            $_SESSION['uid'] = $uid;
        } else {
            $_SESSION['uid'] = $uid;
        }
    } else {
        $usertype = 2;
        $obj->newReg($_SESSION['fb_firstname'], $_SESSION['fb_lastname'], "tbl_ut_user");
        foreach ($obj->showLastId("tbl_ut_user", "uid") as $value) {
            extract($value);
            $_SESSION['uid'] = $value['uid'];
        }
        $fb_data = array('uid' => $uid, 'email' => $_SESSION['fb_email'], 'usertype' => $usertype);
        $obj->insert('tbl_ut_pass', $fb_data);
    }
    $_SESSION['user_lastname'] = $_POST['fb_lastname'];
    $_SESSION['user_firstname'] = $_POST['fb_firstname'];
    $_SESSION['user_pic'] = $_POST['fb_pic'];
    $data = $_SESSION['uid'];
    echo json_encode($data);
}
开发者ID:raymundcuizon,项目名称:lectureclip,代码行数:38,代码来源:api.php

示例4: __autoload

function __autoload($class)
{
    include_once '../lib/' . $class . '.php';
}
$form = new validator();
$obj = new obj();
if (isset($_POST['submit'])) {
    $name_cat = $_POST['name_category'];
    $name_cat_error = $form->walang_laman($name_cat, "Category");
    $errors = $name_cat_error;
    if (!isset($_POST['form_key']) || !$obj->validate()) {
        $error = 'Invalid Token!';
    } else {
        if (empty($errors)) {
            $data = array('catname' => $name_cat);
            $obj->insert('tbl_m_category', $data);
            $success = "yesssssssssssss";
        }
    }
}
//echo $_SESSION['form_key'];
echo $error ? $error : '';
echo $success ? $success : '';
?>
<form action="" method="post">
<?php 
$obj->outputKey();
?>
    <input type="text" name="name_category">
    <?php 
echo $errors ? $errors : '';
开发者ID:raymundcuizon,项目名称:lectureclip,代码行数:31,代码来源:admin.php

示例5: insert

 /**
  * Cadastra u novo registro
  * @param  array $data
  * @return array
  */
 private static function insert($data)
 {
     return self::$psy->insert($data);
 }
开发者ID:EduhAzvdo,项目名称:psyDuck-examples,代码行数:9,代码来源:DataClass.php


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