本文整理汇总了PHP中Record::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::insert方法的具体用法?PHP Record::insert怎么用?PHP Record::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRolesFor
public static function setRolesFor($user_id, $roles)
{
Record::deleteWhere('UserRole', 'user_id = :user_id', array(':user_id' => (int) $user_id));
foreach ($roles as $role => $role_id) {
Record::insert('UserRole', array('user_id' => (int) $user_id, 'role_id' => (int) $role_id));
}
}
示例2: redirector_log_404
function redirector_log_404()
{
$redirect = Record::findAllFrom('Redirector404s', 'url = \'' . $_SERVER['REQUEST_URI'] . '\'');
if (sizeof($redirect) > 0) {
Record::update('Redirector404s', array('hits' => $redirect[0]->hits + 1), 'id = ' . $redirect[0]->id);
} else {
Record::insert('Redirector404s', array('url' => $_SERVER['REQUEST_URI']));
}
}
示例3: Assign
require_once 'Request.php';
require_once 'Users.php';
if (check_cookie($_SERVER['PHP_SELF'], 1)) {
if (!empty($_POST)) {
if (!empty($_POST['aid'])) {
$asn = new Assign();
$asn->id = $_POST['aid'];
$asn->find();
$rec = new Record();
$rec->aid = $_POST['aid'];
$rec->uid = $asn->rid;
$rec->date = parse_date($_POST);
$rec->hours = $_POST['hours'];
$rec->materials = $_POST['materials'];
$rec->cost = str_replace('$', '', $_POST['cost']);
$rec->insert();
} else {
if (!empty($_POST['id'])) {
$rec = new Record();
$date = parse_date($_POST);
$cost = str_replace('$', '', $_POST['cost']);
$query = 'UPDATE record ' . "SET date='{$date}', " . "hours={$_POST['hours']}, " . "materials='{$_POST['materials']}', " . "cost={$cost} " . "WHERE id={$_POST['id']}";
$rec->query($query);
}
}
}
// Initialize values!
$aid = isset($_GET['aid']) ? $_GET['aid'] : '';
$id = isset($_GET['id']) ? $_GET['id'] : '';
$requestor = '';
$requestor_phone = '';
示例4: video_create
/**
* Videos
*/
public function video_create()
{
$record = Record::insert('ecommerce_product_video', $_POST['product_video']);
echo Record::lastInsertId();
}