本文整理汇总了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;
}
示例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>
示例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);
}
示例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 : '';
示例5: insert
/**
* Cadastra u novo registro
* @param array $data
* @return array
*/
private static function insert($data)
{
return self::$psy->insert($data);
}