本文整理汇总了PHP中Record::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Record::query方法的具体用法?PHP Record::query怎么用?PHP Record::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Record
的用法示例。
在下文中一共展示了Record::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ceil
';
$jobs = Record::query($full_query);
$stmt = Record::getConnection()->prepare($full_query);
$stmt->execute();
$rowspage = 20;
//number of data per page
$start = $CurPage * $rowspage;
$jobs_count = $stmt->rowCount();
$totalrecords = $jobs_count;
$lastpage = ceil($totalrecords / $rowspage);
if ($jobs_count <= $rowspage) {
$lastpage = 0;
} else {
$lastpage = abs($lastpage - 1);
}
$jobs = Record::query($full_query . ' LIMIT ' . $start . ',' . $rowspage);
// $jobs= Record::query($full_query);
if ($jobs_count > 0) {
while ($job = $jobs->fetchObject()) {
$quota_left = intval($job->quota - $job->total_assign);
$quota_left = max($quota_left, 0);
$job_start_datetime = strtotime($job->job_date . ' ' . $job->time_in);
$close_secs = $job->close_hour * 3600;
//Convert hour to seconds
$job_expired_time = $job_start_datetime - $close_secs;
$green_cls = '';
if ($job->is_assigned) {
$green_cls = 'green';
$apply_btn = '';
} else {
if ($quota_left == 0 || strtotime(date("Y-m-d H:i")) > $job_expired_time) {
示例2: getData
public function getData($id)
{
global $pawUsers;
// VALIDATE
if (!is_integer($id)) {
return false;
}
// SELECT AND RETURN
$query = "SELECT * FROM " . TABLE_PREFIX . "blacklist WHERE id=:id";
$query = Record::query($query, array(":id" => $id));
if (!empty($query)) {
foreach ($query as $q) {
$user = $pawUsers->getUser($q->author, "id");
$q->author = $user->name;
$q->settings = paw_unserializer($q->settings);
return (array) $q;
}
}
return false;
}
示例3: getMeta
public function getMeta($data, $key, $single = false, $default = false)
{
global $pawUsers;
$data = paw_xss_cleaner($data);
$key = paw_xss_cleaner($key);
// GET USER
if (($user = $pawUsers->getUser($data)) === false) {
return $default;
}
// CHECK IF EXISTS
$query = "SELECT * FROM " . TABLE_PREFIX . "user_meta WHERE user_id=" . $user->id . " AND meta_key=:key";
$query = Record::query($query, array(":key" => $key));
if (empty($query)) {
return $default;
}
// RETURN RESULT
$return = array();
foreach ($query as $line) {
$line->meta_value = paw_unserializer($line->meta_value);
if ($line->meta_unique == 1) {
if ($single === true) {
return $line->meta_value;
} else {
return $line;
}
}
if ($single === true) {
return $line->meta_value;
} else {
$return[] = $line;
}
}
return $return;
}
示例4: Record
$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 = '';
$deadline = '';
$description = '';
$hours = '';
$materials = '';
$cost = '';
if ($aid) {
$asn = new Assign();
示例5: array
<?php
$post_in_item = array('CART_media');
?>
<input id="post_in_tables" name="post_in_tables" type="hidden" value="<?php
echo str_replace(' ', '', implode(',', $post_in_item));
?>
" />
<input id="post_in_prod" name="post_in_prod" type="hidden" value="<?php
echo $prod['id'];
?>
" />
<?php
$i = 0;
$imgdb = Record::query("select * from CART_media where pid = '" . $prod['id'] . "' order by priority");
while ($img = $imgdb->fetch(PDO::FETCH_ASSOC)) {
if ($i == 0) {
echo '<h3>' . __('Edit Media Gallery for ') . $prod['name'] . '</h3>';
}
$i++;
?>
<input id="post_in_item" name="post_in_item[]" type="hidden" value="<?php
echo $img['id'];
?>
" />
<input id="url" name="url[<?php
echo $img['id'];
?>
]" type="hidden" value="<?php
示例6: save_album_order
public function save_album_order()
{
$album_array = $_POST['album_id'];
$order_array = $_POST['order'];
// $gallery = new Gallery;
foreach ($album_array as $key => $value) {
$album_id = $value;
$album_order = $order_array[$key];
Record::query("Update wolf_album SET sequence='" . $album_order . "' WHERE id='" . $album_id . "'");
}
Flash::set('success', __('This album sequence has been saved.'));
redirect(get_url('gallery'));
}
示例7: while
echo $sh->enum_to_select("SHOW FIELDS FROM CART_orders where field = 'status'", $ord['order_id'], $ord['status']);
?>
</p>
</div>
<div class="half-r">
<p>Products ordered: </p>
<br />
<p class="table_row table_header">
<span>Product #</span>
<span>Name</span>
<span>Sold Price/each</span>
<span>Qty</span>
</p>
<?php
$order_prod = Record::query("select * from CART_order_product\n left join CART_products on CART_products.id = CART_order_product.product_id\n where order_id = " . $ord['order_id']);
while ($o = $order_prod->fetch(PDO::FETCH_ASSOC)) {
$order_total += $o['sold_price'] * $o['quantity'];
echo " \n <p class=\"table_row\">\n <span>" . $o['product_id'] . "</span>\n <span title=\"full id: " . $o['product_options_full_id'] . "\">" . ucwords($o['product_options_full_name']) . "</span>\n <span>\$" . $o['sold_price'] . "</span>\n <span>" . $o['quantity'] . "</span>\n </p>\n ";
}
?>
<br />
<?php
if ($ord['coupon']) {
echo "<p><b>Coupon code: </b>" . ucwords($ord['coupon']) . "</p>";
}
?>
<?php
if ($ord['payment_confirmation']) {
示例8: view
public function view()
{
$this->_checkPermission();
$paths = func_get_args();
$id = urldecode(join('/', $paths));
$mysidebarlink = Record::query('select * from ' . TABLE_PREFIX . 'sidebarlink where id="' . $id . '"');
$sidebarlink = $mysidebarlink->fetchObject();
$this->display('sidebarlink/view', array('sidebarlink' => $sidebarlink, 'pages' => Record::findAllFrom('Page', 'parent_id=1 OR parent_id=0 order by parent_id,position')));
}
示例9: save_category_order
public function save_category_order()
{
$news_array = $_POST['news_category_id'];
$order_array = $_POST['order'];
foreach ($news_array as $key => $value) {
$news_id = $value;
$news_order = $order_array[$key];
$cat = Record::query('Update ' . TABLE_PREFIX . 'newscategory set sequence=' . $news_order . ' where id="' . $news_id . '"');
$cat->execute();
}
Flash::set('success', __('This news category sequence has been saved.'));
redirect(get_url('news'));
}
示例10: Employee
} else {
if (!preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", $login_email)) {
$error = "invalidemail";
} else {
$employee = new Employee();
if ($employee->countFrom('Employee', 'email = "' . $login_email . '" AND NRIC = "' . $login_nric . '"') > 0) {
$employee = $employee->findOneFrom('Employee', 'email="' . $login_email . '" AND NRIC = "' . $login_nric . '"');
if ($employee->suspended || !$employee->validate) {
$error = "invalidstatus";
} else {
$employee_id = $employee->employee_id;
$employee_email = $employee->email;
$rand_pass = substr(md5(uniqid()), 0, 6);
$encrypt_pass = md5($rand_pass);
// $encrypted = md5(mktime());
$employee = Record::query('UPDATE ' . TABLE_PREFIX . 'employee set password="' . $encrypt_pass . '" WHERE employee_id = "' . $employee_id . '"');
//Send reset password email to employee
$users = new User();
$user = $users->findOneFrom('User', 'id=1');
$emailTo = $user->email;
//Admin Email
$subject = "[CONA] New Login Password";
$content = "You have recently requested a new password,<br />";
$content .= "Please find your new password: " . $rand_pass . "<br /><br />";
// $content .= "For security purposes, we ask you to confirm your email address before we can proceed with resetting your password.<br />";
// $content .= "Click here to confirm your email address > <a href='".URL_PUBLIC."reset-password?id=".$employee_id."&ref=".$encrypted."'>Reset Link</a><br /><br />";
// $content .= "In case the link does not work, please copy and paste the following into your browser address bar:<br />";
// $content .= URL_PUBLIC."reset-password?id=".$employee_id."&ref=".$encrypted." <br /><br />";
$content .= "For changes or enquiries, please contact us at xxxx@cona.com.";
$headers = 'From: CONA <' . $emailTo . '>' . "\r\n";
$headers .= 'Reply-To: ' . $emailTo . "\r\n";
示例11: md5
$current_password = $_POST["current_password"];
$new_password = $_POST["new_password"];
$re_new_password = $_POST["re_new_password"];
//Compare entered password with current one
$encrypt_current_password = md5($current_password);
echo $encrypt_current_password;
if ($encrypt_current_password != $old_password) {
$status = "failed";
$msg = "Current password is not valid. Please enter again.";
} else {
if ($new_password != $re_new_password) {
$status = "failed";
$msg = "New password is not match.";
} else {
$enrypt_new_password = md5($new_password);
$employee = Record::query('UPDATE ' . TABLE_PREFIX . 'employee set password = "' . $enrypt_new_password . '" where employee_id="' . $employee_id . '"');
$status = "success";
}
}
redirect(get_url('employee/setting?status=' . $status . '&msg=' . $msg));
}
}
?>
<div id="employee-login" align=center>
<?php
if (isset($_GET['status1'])) {
if ($_GET['status1'] == 'success') {
echo '<p class="tbSuccess">Status: You had successfully updated your profile.</p>';
} else {
if (isset($_GET['msg1'])) {
示例12: getCategoryName
public static function getCategoryName($id)
{
$category = Record::query('select title from ' . TABLE_PREFIX . 'newscategory WHERE id=' . $id);
return $category->fetchColumn();
}
示例13: edit_media
public function edit_media()
{
$this->clean_post($_POST);
$tables = array();
$tables = isset($_POST['post_in_tables']) ? explode(',', str_replace(' ', '', $_POST['post_in_tables'])) : null;
if (!AuthUser::hasPermission('shopping_cart_edit') || empty($tables)) {
Flash::set('error', __('You are not allowed to perform this operation.'));
redirect(get_url('plugin/shopping_cart/'));
}
if (isset($_POST['post_in_item'])) {
foreach ($_POST['post_in_item'] as $k => $v) {
if (!isset($_POST['delete_image'][$v])) {
// update
Record::query(" UPDATE " . $tables[0] . " SET\n alt = '" . $_POST['alt'][$v] . "',\n width = '" . $_POST['width'][$v] . "',\n height = '" . $_POST['height'][$v] . "',\n detail_width = '" . $_POST['detail_width'][$v] . "',\n type = '" . $_POST['type'][$v] . "',\n status = '" . $_POST['status'][$v] . "',\n priority = '" . $_POST['priority'][$v] . "'\n WHERE id = '{$v}'\n ");
} else {
Record::query("delete from " . $tables[0] . " where id = '{$v}' ");
unlink(FILES_DIR . '/../' . $_POST['url'][$v]);
}
}
}
if (isset($_FILES['new_url']['name'][0]) && !empty($_FILES['new_url']['name'][0])) {
$new_image_name = array();
foreach ($_FILES['new_url']['name'] as $k => $v) {
$new_image_name[$k] = $this->_upload_file($_FILES['new_url']['name'][$k], FILES_DIR . '/../' . $this->product_image_folder, $_FILES['new_url']['tmp_name'][$k]);
Record::query("INSERT INTO " . $tables[0] . " (pid, url, alt, width, type, status, priority) VALUES (" . $_POST['post_in_prod'] . ", '" . $this->product_image_folder . $new_image_name[$k] . "', '" . $_POST['new_alt'][$k] . "', '" . $_POST['new_width'][$k] . "', '" . $_POST['new_type'][$k] . "', '" . $_POST['new_status'][$k] . "', " . $_POST['new_priority'][$k] . ")");
}
}
Flash::set('success', __('Product media has been saved.'));
redirect(get_url("plugin/shopping_cart"));
}
示例14: md5
if (strlen($signature) > 0) {
$signature_filename = md5(uniqid(rand(), true)) . '.png';
generateBase64Image($signature, $upload_path . 'signature/' . $signature_filename);
}
if (strlen($profile_image) > 0) {
$profile_filename = md5(uniqid(rand(), true)) . '.png';
generateBase64Image($profile_image, $upload_path . 'profile/' . $profile_filename);
}
if (strlen($NRIC_front) > 0) {
$nricfront_filename = md5(uniqid(rand(), true)) . '.png';
generateBase64Image($NRIC_front, $upload_path . 'nric/' . $nricfront_filename);
}
if (strlen($NRIC_back) > 0) {
$nricback_filename = md5(uniqid(rand(), true)) . '.png';
generateBase64Image($NRIC_back, $upload_path . 'nric/' . $nricback_filename);
}
//Image decode, generate and upload
$dob = date("Y-m-d", strtotime($dob));
$student_pass_expiry = date("Y-m-d", strtotime($student_pass_expiry));
$register_date = date("Y-m-d");
$suspended = 0;
$status = '';
$from_source = 'ipad';
}
//Add to database
if (strlen($fullname) > 0 && strlen($email) > 0 && strlen($NRIC) > 0) {
Record::query('INSERT INTO ' . TABLE_PREFIX . 'employee (`employee_id`,`fullname`,`email`,`NRIC`,`passport_no`,`dob`,`pob`,`citizenship`,`gender`,`age`,`race`,`mobiletel`,`hometel`,`address`,`referee`,`educate_level`,`school`,`course`,`highest_educate`,`educate_from`,`educate_to`,`student_pass_expiry`,`contact_name`,`contact_mobiletel`,`contact_hometel`,`contact_relationship`,`contact_address`,`suspended`,`status`,`register_date`,`signature`,`profile_image`,`NRIC_front`,`NRIC_back`,`from_source`) VALUES("0","' . addslashes($fullname) . '","' . addslashes($email) . '","' . addslashes($NRIC) . '","' . addslashes($passport_no) . '","' . addslashes($dob) . '","' . addslashes($pob) . '","' . addslashes($citizenship) . '","' . addslashes($gender) . '","' . addslashes($age) . '","' . addslashes($race) . '","' . $mobiletel . '","' . addslashes($hometel) . '","' . addslashes($address) . '","' . addslashes($referee) . '","' . addslashes($educate_level) . '","' . addslashes($school) . '","' . addslashes($course) . '","' . addslashes($highest_educate) . '","' . addslashes($educate_from) . '","' . addslashes($educate_to) . '","' . addslashes($student_pass_expiry) . '","' . addslashes($contact_name) . '","' . addslashes($contact_mobiletel) . '","' . addslashes($contact_hometel) . '","' . addslashes($contact_relationship) . '","' . addslashes($contact_address) . '","' . $suspended . '","' . addslashes($status) . '","' . addslashes($register_date) . '","' . addslashes($signature_filename) . '","' . addslashes($profile_filename) . '","' . addslashes($nricfront_filename) . '","' . addslashes($nricback_filename) . '","' . $from_source . '")');
// $PDO = Record::getConnection();
// $last_id = $PDO->lastInsertId();
}
}
示例15: browse
public function browse()
{
$this->_checkPermission();
$params = func_get_args();
$this->path = join('/', $params);
// make sure there's a / at the end
if (substr($this->path, -1, 1) != '/') {
$this->path .= '/';
}
$careers = Record::query('select * from ' . TABLE_PREFIX . 'career ORDER BY sequence asc, id desc');
$this->display('career/index', array('careers' => $careers));
}