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


PHP MySQLDatabase::query方法代码示例

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


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

示例1: getDataFromDB

 /**
  * Get settings data from DB.
  *
  * @access	private
  * @return	array
  */
 private function getDataFromDB()
 {
     $data = array();
     $query = $this->db->query("\n\t\t\tSELECT setting_name, setting_value\n\t\t\tFROM ts_system_settings\n\t\t\tORDER BY id\n\t\t");
     while (($row = $this->db->fetchAssoc($query)) != NULL) {
         $data[$row['setting_name']] = $row['setting_value'];
     }
     return $data;
 }
开发者ID:jahanzaibbahadur,项目名称:Ticket-System,代码行数:15,代码来源:Cache.php

示例2: signUp

 /**
  * Add new user to database. Check if all fields were correctly filled in
  * and were they filled at all. Also check is there already user with such
  * user name and email.
  *
  * @access	public
  * @param	string	User name.
  * @param	string	User password.
  * @param	string	Re-typed user password.
  * @param	string	User email.
  */
 public function signUp($username = "", $userpass = "", $reuserpass = "", $email = "")
 {
     # Check for emptyness
     if ($this->validator->required($username, $userpass, $reuserpass, $email)) {
         # Compare passwords
         if ($this->validator->compareVals($userpass, $reuserpass)) {
             $userData = array('username' => $username, 'email' => $email);
             # Before adding, check does such user already exist
             if (!$this->chkUserExistance($userData)) {
                 # Let us control is it first user or no
                 # If he/she is first user, then it is probably admin
                 $userCount = $this->db->fetchAssoc("SELECT COUNT(1) AS total FROM ts_users");
                 if ($userCount['total'] == 0) {
                     $userGroup = 1;
                 } else {
                     $userGroup = 2;
                 }
                 # Add new user to database
                 $this->db->query("\n\t\t\t\t\t\tINSERT INTO ts_users(\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tusername,\n\t\t\t\t\t\t\tuserpass,\n\t\t\t\t\t\t\temail,\n\t\t\t\t\t\t\tugroup\n\t\t\t\t\t\t) VALUES(\n\t\t\t\t\t\t\tNULL,\n\t\t\t\t\t\t\t'" . $this->db->escapeVal($username) . "',\n\t\t\t\t\t\t\t'" . $this->db->escapeVal($this->hashPassword($username, $userpass)) . "',\n\t\t\t\t\t\t\t'" . $this->db->escapeVal($email) . "',\n\t\t\t\t\t\t\t" . $this->db->escapeVal($userGroup) . "\n\t\t\t\t\t\t)\n\t\t\t\t\t");
             }
         }
     }
     # Redirect to main page
     header("Location: / ");
 }
开发者ID:jahanzaibbahadur,项目名称:Ticket-System,代码行数:36,代码来源:UserManager.php

示例3: query

 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     if (in_array(strtolower(substr($sql, 0, strpos($sql, ' '))), $this->writeQueries)) {
         throw new Exception("Attempted to write to readonly database");
     }
     return parent::query($sql, $errorLevel);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-ssautesting,代码行数:7,代码来源:DummyReadonlyMySQLDatabase.php

示例4: query

 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     $query = new stdClass();
     $query->query = $sql;
     $query->source = '';
     $query->count = 0;
     $trace = $this->userCaller();
     if ($trace) {
         $query->source = 'Line ' . $trace['line'] . ' in ' . $trace['file'];
     }
     $this->queryRecord[] = $query;
     if (isset($this->allQueries[$sql])) {
         $cur = isset($this->duplicateQueries[$sql]) ? $this->duplicateQueries[$sql] : $query;
         if (!isset($cur->count)) {
             $cur->query = $sql;
             $cur->count = 0;
         }
         $cur->count = $cur->count + 1;
         if ($cur->count > 2 && !isset($cur->source)) {
             // lets see where it's coming from
             $trace = $this->userCaller();
             if ($trace) {
                 $cur->source = 'Line ' . $trace['line'] . ' in ' . $trace['file'];
             }
         }
         $this->duplicateQueries[$sql] = $cur;
     }
     // mark as having executed this query
     $this->allQueries[$sql] = true;
     return parent::query($sql, $errorLevel);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-ssautesting,代码行数:31,代码来源:DevMySQLDatabase.php

示例5: query

 /**
  * If a write query is detected, hand it off to the configured write database
  * 
  * @param string $sql
  * @param int $errorLevel
  * @return \MySQLQuery
  */
 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     if (in_array(strtolower(substr($sql, 0, strpos($sql, ' '))), $this->writeQueries) || $this->writePerformed) {
         $alternateReturn = $this->writeDb()->query($sql, $errorLevel);
         $this->writePerformed = true;
         return $alternateReturn;
     }
     return parent::query($sql, $errorLevel);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-splitdb,代码行数:16,代码来源:ReadWriteMySQLDatabase.php

示例6: query

 /**
  * 
  * @param string $sql
  * @param integer $errorLevel
  * @return SS_Query
  */
 public function query($sql, $errorLevel = E_USER_ERROR)
 {
     $query = parent::query($sql, $errorLevel);
     if (isset($_REQUEST['showqueries']) && Director::isDev()) {
         $count = 1 + (int) Config::inst()->get('MySQLDebuggableDatabase', 'queries_count');
         Config::inst()->update('MySQLDebuggableDatabase', 'queries_count', $count);
         Debug::message(PHP_EOL . 'Query Counts: ' . $count . PHP_EOL, false);
     }
     return $query;
 }
开发者ID:deviateltd,项目名称:silverstripe-cacheable,代码行数:16,代码来源:MySQLDebuggableDatabase.php

示例7: addTicket

 /**
  * Add new ticket into database.
  *
  * @access	public
  * @param	int	Selected urgency.
  * @param	int	Selected category.
  * @param	string	Subject of the ticket.
  * @param	string	Content of the ticket.
  */
 public function addTicket($urgency, $services, $subject = "", $content = "")
 {
     if ($this->validator->required($urgency, $services, $subject, $content)) {
         $query1 = $this->chkTicketExistance("table", "ts_ticket_topic", "subject", $subject);
         $query2 = $this->chkTicketExistance("table", "ts_ticket_topic", "content", $content);
         if (!$query1 && !$query2) {
             // Later user method whoIsFromStaff
             $this->db->query("\n\t\t\t\t\tINSERT INTO ts_ticket_topic(\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tauthor_id,\n\t\t\t\t\t\trecepient_id,\n\t\t\t\t\t\tsubject,\n\t\t\t\t\t\tdate_time,\n\t\t\t\t\t\tcategory_id,\n\t\t\t\t\t\tpriority_id,\n\t\t\t\t\t\tstatus_id,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t\tuser_ip\n\t\t\t\t\t) VALUES(\n\t\t\t\t\t\tNULL,\n\t\t\t\t\t\t" . $this->db->escapeVal($_SESSION['id']) . ",\n\t\t\t\t\t\t1,\n\t\t\t\t\t\t'" . $this->db->escapeVal($subject) . "',\n\t\t\t\t\t\tNOW(),\n\t\t\t\t\t\t" . $this->db->escapeVal($services) . ",\n\t\t\t\t\t\t" . $this->db->escapeVal($urgency) . ",\n\t\t\t\t\t\t1,\n\t\t\t\t\t\t'" . $this->db->escapeVal($this->validator->eliminateTags($content)) . "',\n\t\t\t\t\t\t'" . $this->db->escapeVal($_SERVER['REMOTE_ADDR']) . "'\n\t\t\t\t\t)\n\t\t\t\t");
         }
     }
     header("Location: / ");
 }
开发者ID:jahanzaibbahadur,项目名称:Ticket-System,代码行数:21,代码来源:Ticket.php

示例8: paginate

 /**
  * Main method.
  * Returns resource with selected entries.
  *
  * @access	public
  * @param	int	Select on what page user is currebtly.
  * @return	resource
  */
 public function paginate($page_num = '')
 {
     if ($page_num == '' || $page_num == 1) {
         $this->curPage = 1;
     } else {
         $this->curPage = $page_num;
     }
     $this->pageCheck = $this->chkPageNr($this->curPage);
     $this->startFrom = ($this->curPage - 1) * $this->entryPerPage;
     if ($this->user->isAdmin()) {
         $this->entriesToDisplay = $this->db->query("\n\t\t\t\tSELECT id, date_time, category_name, subject, status_name, priority_name\n\t\t\t\tFROM ts_tickets_view\n\t\t\t\tWHERE status_name = 'Opened'\n\t\t\t\tLIMIT " . $this->db->escapeVal($this->startFrom) . ", " . $this->db->escapeVal($this->entryPerPage));
     } else {
         $this->entriesToDisplay = $this->db->query("\n\t\t\t\tSELECT id, date_time, category_name, subject, status_name, priority_name\n\t\t\t\tFROM ts_tickets_view\n\t\t\t\tWHERE author_id = " . $this->db->escapeVal($this->user->id) . "\n\t\t\t\tLIMIT " . $this->db->escapeVal($this->startFrom) . ", " . $this->db->escapeVal($this->entryPerPage));
     }
     return $this->entriesToDisplay;
 }
开发者ID:jahanzaibbahadur,项目名称:Ticket-System,代码行数:24,代码来源:Pagination.php

示例9: admission_status

$database = new MySQLDatabase();
$faculty = htmlspecialchars($_POST['faculty_id'], ENT_QUOTES);
$department = htmlspecialchars($_POST['department_id'], ENT_QUOTES);
$state = htmlspecialchars($_POST['state'], ENT_QUOTES);
$gender = htmlspecialchars($_POST['gender'], ENT_QUOTES);
$admission_status = htmlspecialchars($_POST['admission_status'], ENT_QUOTES);
$form_id = htmlspecialchars($_POST['form_id'], ENT_QUOTES);
$applicant_name = htmlspecialchars($_POST['applicant_name'], ENT_QUOTES);
$date_from = htmlspecialchars($_POST['date_from'], ENT_QUOTES);
$date_to = htmlspecialchars($_POST['date_to'], ENT_QUOTES);
$arrayDateSpec = array();
if ($date_from != NULL && $date_to != NULL) {
    $arrayDateSpec = array($date_from, $date_to);
}
if ($faculty != 'all') {
    $faculty_details_result = $database->query("SELECT * FROM faculty WHERE faculty_id='" . $faculty . "'");
    $faculty_details = $database->fetch_array($faculty_details_result);
    $faculty_code = $faculty_details['faculty_code'];
} else {
    $faculty_code = 'all';
}
if ($state != 'all') {
    $lga_result = $database->query("SELECT lga_id FROM lga WHERE state_id = '" . $state . "'");
    $lga = array();
    while ($row = $database->fetch_array($lga_result)) {
        array_push($lga, $row);
    }
}
$array_values = array('p.student_status' => $faculty_code, 'p.programme_applied_id' => $department, 'state_id' => $state, 'p.gender' => $gender, 'ads.status' => $admission_status, 'p.form_id' => $form_id, 'applicant_name' => $applicant_name, 'date' => $arrayDateSpec);
function admission_status($status)
{
开发者ID:Ghaji,项目名称:transcripts,代码行数:31,代码来源:ajax_view.php

示例10: form_id_generator

function form_id_generator($applicant_id, $programme)
{
    //get the length of random number to generate
    $random_number_length = 6 - strlen($applicant_id);
    //get d last two digits of the session
    $database = new MySQLDatabase();
    $selectsessionsql = $database->query("SELECT session FROM application_status WHERE id=1");
    $result = $database->fetch_array($selectsessionsql);
    $year = explode('/', $result['session']);
    $year = substr($year[0], 2, 2);
    $random_number = rand(pow(10, $random_number_length - 1), pow(10, $random_number_length) - 1);
    // The function returns year, programme
    return $year . $programme . $random_number . $applicant_id;
}
开发者ID:Ghaji,项目名称:form_application,代码行数:14,代码来源:functions.php

示例11: MySQLDatabase

			<?php 
include_layout_template('admin_menu.php');
?>

			<div class="span9">
				<h2>Send Mail To Admin</h2>
                <hr>
                <h3>Note:</h3>
                <ul>
                	<li>This function is used for sending of mails to other admins</li>
                    <li>You will be required to enter your unijos mail password before you can send the mail</li>
                </ul>
                <?php 
$database = new MySQLDatabase();
$sql_all_users = $database->query("SELECT * FROM admin_users");
$admin_details = AdminLog::find_by_sql("SELECT * FROM admin_users WHERE user_id='" . $session->applicant_id . "'");
$admin_details = array_shift($admin_details);
?>
                <form action="" method="POST" class="form-horizontal sendmail" id="sendmail" >
                
                	<div class="control-group">
                        <label class="control-label" for="inputEmail">Email: </label>
                        <div class="controls">
                            <div class="input-prepend">
                            <span class="add-on"><i class="icon-envelope"></i></span>
                                <input type="text" class="input-large" value="<?php 
echo $admin_details->email;
?>
" id="email" name="email" readonly />
                            </div>
开发者ID:Ghaji,项目名称:form_application,代码行数:30,代码来源:sendmail.php

示例12: WebPages

$lname = $db->sanitizeInput($_POST['lastname']);
$email = $db->sanitizeInput($_POST['email']);
$phonenum = $db->sanitizeInput($_POST['phonenumber']);
$username = $_SESSION['valid_user'];
//$teams_checked = sanitize_input_for_db($_POST['team']);
$password = sha1($_POST['password']);
$address = $db->sanitizeInput($_POST['address']);
$city = $db->sanitizeInput($_POST['city']);
$state = $db->sanitizeInput($_POST['state']);
$zip = $db->sanitizeInput($_POST['zip']);
$table = 'member';
//check to see if password is entered
echo "confirmed passwd: " . $_POST['confirm_password'] . "\n";
echo "passwd: " . $_POST['password'];
if ($_POST['password'] == $_POST['confirm_password']) {
    $query = "UPDATE {$table} SET fname = '{$fname}', lname='{$lname}', password='{$password}', phone_number='{$phonenum}',  street='{$address}', city='{$city}', state='{$state}', zip='{$zip}' \r\n\t\tWHERE username='{$username}'";
    $result = $db->query($query);
    $message = "Your account had been updated successfully.";
} else {
    $message = "Both password must be the same, Please try again";
}
$db->closeConnection();
//diplay message
$wp = new WebPages("NVC Account Update");
echo $wp->content_area_tag;
$wp->displayLeftMenus();
$wp->displayContentFullWidthWithLeftMenu($message);
$wp->displayFooter();
echo $wp->content_area_tag_end;
echo $wp->wrapper_tag_end;
echo $wp->body_tag_end;
开发者ID:nvcpress,项目名称:nvcpress_web30,代码行数:31,代码来源:update_account_info.php

示例13:

								<input type="text" readonly name="applicant_number" placeholder="Applicant Number" class="input-xlarge" value="<?php 
echo $result->student_id;
?>
" />
							</div>
						</div>
					</div>

					<div class="control-group">
						<label class="control-label">Response Description</label>
						<div class="controls">
							<div class="input-prepend">
								<span class="add-on"><i class="icon-chevron-down"></i></span>
                                <select class="input-xlarge" name="approval_status" id="approval_status" >
                                <?php 
$arrayDescription = $database->query("SELECT * FROM interswitch_error_code WHERE status=1");
while ($rowDesc = $database->fetch_array($arrayDescription)) {
    if ($rowDesc['response_code'] == $result->ResponseCode) {
        echo '<option selected="selected" value="' . $rowDesc['response_code'] . '">' . $rowDesc['response_description'] . '</option>';
    } else {
        echo '<option value="' . $rowDesc['response_code'] . '">' . $rowDesc['response_description'] . '</option>';
    }
}
?>
                            </select>
							</div>
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">Amount</label>
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:view_log_acc.php

示例14:

            <div class="input-prepend">
                <span class="add-on"><i class="iconic-hash"></i></span>
                <input type="text" class="input-xlarge" required id="app_no" name="app_no" value="<?php 
if (isset($application_no)) {
    echo $application_no;
}
?>
" readonly="readonly" />
            </div>
        </div>
    </div>

    <!-- Title -->
    <?php 
$sql_title = "SELECT * FROM titles WHERE title_visible = 1";
$result = $database->query($sql_title);
?>
    <div class="control-group">
        <label class="control-label" for="inputTitle">Title</label>
        <div class="controls">
            <div class="input-prepend">
            <span class="add-on"><i class="icon-chevron-down"></i></span>
                <select class="input-xlarge" name="title_id" id="title_id" >
                    <option value="">--Title--</option>
                    <?php 
while ($row = $database->fetch_array($result)) {
    if ($row['id'] == $user->title_id) {
        echo '<option selected="selected" value="' . $row['id'] . '">' . $row['title_name'] . '</option>';
    } else {
        echo '<option value="' . $row['id'] . '">' . $row['title_name'] . '</option>';
    }
开发者ID:Ghaji,项目名称:transcripts,代码行数:31,代码来源:transcript_application.php

示例15: User

if (!$session->is_logged_in()) {
    redirect_to('index.php');
}
$user = new User();
$user->applicant_id = $session->applicant_id;
$progress = $user->find_by_sql("SELECT progress FROM personal_details WHERE applicant_id='" . $user->applicant_id . "'");
$progress = array_shift($progress);
if ($progress->progress != 'Completed') {
    redirect_to('application_form.php');
}
$student_status = $user->get_student_status();
$database = new MySQLDatabase();
?>

<?php 
$personal_details = $database->query("SELECT * FROM personal_details p, title t, lga l, state s, religion r, nationality n, department d, faculty f, next_of_kin next, marital mar, photographs photo WHERE p.applicant_id='" . $session->applicant_id . "' AND p.title_id=t.title_id AND p.lga_id=l.lga_id AND l.state_id=s.state_id AND p.religion_id=r.religion_id AND p.country_id=n.country_id AND p.programme_applied_id=d.department_id AND d.faculty_id=f.faculty_id AND p.applicant_id=next.applicant_id AND p.applicant_id=photo.applicant_id AND p.marital_status=mar.marital_status_id");
$personal_details = $database->fetch_array($personal_details);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>University of Jos, Nigeria - <?php 
echo $personal_details['faculty_name'];
?>
 Complete Application Form</title>
<?php 
require_once LIB_PATH . DS . 'javascript.php';
require_once LIB_PATH . DS . 'css.php';
?>
<style type="text/css">
开发者ID:Ghaji,项目名称:form_application,代码行数:31,代码来源:home.php


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