本文整理汇总了PHP中User_Model::getNextID方法的典型用法代码示例。如果您正苦于以下问题:PHP User_Model::getNextID方法的具体用法?PHP User_Model::getNextID怎么用?PHP User_Model::getNextID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User_Model
的用法示例。
在下文中一共展示了User_Model::getNextID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add()
{
$argumentarray = Router::$arguments;
//$id = $argumentarray[0];
$users = new User_Model();
$id = $users->getNextID();
if (isset($_POST['save'])) {
$post = new Validation(array_merge($_POST, $_FILES));
$post->pre_filter('trim', 'userFirstName', 'userLastName', 'userEmail', 'userPhone');
$post->add_rules('userFirstName', 'required');
$post->add_rules('userLastName', 'required');
$post->add_rules('userEmail', 'required');
$post->add_rules('userPhone', 'required');
if (!$post->validate()) {
$errors = $post->errors('form_errors');
foreach ($errors as $error) {
echo '<p class="error">' . $error . '</p>';
}
} else {
//$id = $argumentarray[0];
$users = new User_Model();
$user = ORM::factory('user');
$user->firstname = $post->userFirstName;
$user->lastname = $post->userLastName;
$user->email = $post->userEmail;
$user->phone1 = $post->userPhone;
$user->site_id = 1;
try {
$user->save();
url::redirect('/users/edit/' . $user->id);
} catch (Exception $ex) {
echo 'There was an error adding this user: ' . $ex->getMessage();
//url::redirect('/users/');
}
}
}
$this->_renderView();
}
示例2:
}
</script>
<?php
//$id = $this->uri->segment(3);
$argumentarray = Router::$arguments;
$users = new User_Model();
$user_shipping = new User_shipping_info_Model();
$user_billing = new User_billing_info_Model();
$orderdb = new Order_Model();
if (isset($argumentarray[0])) {
$id = $argumentarray[0];
$user = $users->getUserByID($id);
$site = ORM::factory('site', $user->site_id);
} else {
$id = $users->getNextID();
$user = ORM::factory('user');
}
$orders = Order::getOrdersByUser($id);
$i = 0;
$j = 0;
$shipping_infos = $user_shipping->getShippingInfoByUser($id);
$billing_infos = $user_billing->getBillingInfoByUser($id);
//$orders = $orderdb->getOrdersFromUser($id);
//$db = new Database();
//$orders = $db->select('orders.id as order_id, orders.order_qty as order_qty, orders.order_total as order_total, orders.order_date as order_date, payment_status.name as status_name ')->from('orders')
// ->join('payments', 'orders.paymentID', 'payments.id', 'left')
// ->join('payment_status', 'payments.statusID', 'payment_status.id', 'left')
// ->where('orders.id',$id)
// ->get()
// ;