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


PHP database::get_instance方法代码示例

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


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

示例1: post_profile

 public function post_profile($table, $col_name, $type)
 {
     $this->object = database::get_instance();
     $users = DB::table('users_login')->orderBy('id', 'desc')->first();
     $stu_id = $users->user_session;
     $id = $this->object->view($table, "where_pluck", $col_name, '=', $stu_id, 'id');
     $profile_image = $this->object->view($table, "where_pluck", 'id', '=', $id, 'profile_image');
     Session::put('table', $table);
     if (Auth::attempt(array('password' => Input::get('old_pass')))) {
         if (Input::get('new_pass') == Input::get('pass_confirm')) {
             $this->add_file = $this->object->upload_file('profile_images', $table, 'upload', 'profile_image', "update", 'id', $id, $profile_image);
             $val = array('password' => Hash::make(Input::get('new_pass')));
             $this->object->update($table, 'id', $id, $val);
         } else {
             $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct new password');
         }
     } else {
         $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct Old password');
     }
     if ($this->add_file) {
         $return = Redirect::to('profile=' . $type)->with('success', 'You successfully Update Your Profile.');
     } else {
         $return = Redirect::to('profile=' . $type)->with('exists', 'Please Select a file');
     }
     return $return;
 }
开发者ID:Ahmed-Mohamed1994,项目名称:Grade_System_laravel,代码行数:26,代码来源:UserProfile.php

示例2: post_make_notify

 public function post_make_notify($type)
 {
     $object = database::get_instance();
     $data = ['msg' => Input::get('des')];
     $table = Input::get('choose');
     $col = '';
     $count = 0;
     Session::put("key", $type);
     $col = 'mail';
     $count = DB::table('register_course_section')->where('course_id', '=', Input::get('courses'))->count('student_id');
     $array = array();
     for ($i = 0; $i < $count; $i++) {
         if ($object->view("{$table}", 'where_pluck', 'id', '=', $i + 1, $col)) {
             $array[$i] = $object->view("{$table}", 'where_pluck', 'id', '=', $i + 1, $col);
         }
     }
     Mail::queueOn('mail', 'emails.mailer', $data, function ($message) use($array) {
         $file = Input::file('upload');
         $destinationPath = "/wamp/www/GradeSystem/public/assets/Notify_files";
         $filename = str_random(6) . '_' . $file->getClientOriginalName();
         $uploadSuccess = $file->move($destinationPath, $filename);
         $subject = Input::get('subject');
         $description = Input::get('des');
         if (Session::get("key") == "assignment") {
             $val = array("course_id" => Input::get('courses'), "teacher_id" => Input::get('teacher_id'), "grade" => Input::get('grade'), "deadline" => Input::get('deadline'), "assignment" => $filename, "assignment_name" => $subject, "description" => $description);
             $o = database::get_instance();
             $o->add("prof_teacher_assignment", $val);
         }
         $message->to($array)->subject($subject);
         $message->attach("{$destinationPath}/{$filename}");
     });
     return Redirect::to('make_teacher_notify=' . $type)->with('success', 'You Successfully Notify all Your ' . "{$table}");
 }
开发者ID:Hassan-Alaa,项目名称:Grade-System,代码行数:33,代码来源:TeacherNotify.php

示例3: save

 public function save()
 {
     $db = database::get_instance();
     if (count($this->changed_entries) > 0) {
         $tmp = array();
         $bool = false;
         foreach ($this->changed_entries as $name) {
             if ($name == "table") {
                 continue;
             }
             if ($name == "{$this->table}_id") {
                 $bool = true;
             }
             $value = $this->entries[$name] === 'NULL' || $this->entries[$name] === null ? "NULL" : "'" . $db->escape($this->entries[$name]) . "'";
             $tmp[] = "`{$name}` = {$value}";
         }
         if ($bool == false && isset($this->entries["{$this->table}_id"])) {
             $tmp[] = "`{$this->table}_id` = '" . $db->escape($this->entries["{$this->table}_id"]) . "'";
         }
         $sql = "INSERT INTO `{$this->table}` SET " . implode(",", $tmp) . " ON DUPLICATE\n\t\t\t\t\t\t\tKEY UPDATE " . implode(",", $tmp) . ";";
         debug::add_info("(" . __FILE__ . ")<b>" . __CLASS__ . "</b>::" . __FUNCTION__ . "(): \$sql:<br /><pre>{$sql}</pre>");
         $result = $db->query($sql);
         if (!isset($this->entries["{$this->table}_id"])) {
             $this->entries["{$this->table}_id"] = $db->insert_id();
         }
         $this->reset();
     }
     return;
 }
开发者ID:q4z1,项目名称:pokerth_monthlycup,代码行数:29,代码来源:base.php

示例4: delete_entry_by_id

 public static function delete_entry_by_id($settings_id)
 {
     // debug::add_info("(".__FILE__.")<b>".__CLASS__."</b>::".__FUNCTION__."($settings_id) betreten.");
     $db = database::get_instance();
     $settings_id = $db->escape($settings_id);
     $sql = "\n\t\t\tDELETE FROM `settings` WHERE `settings_id` = {$settings_id};\n\t\t";
     return $db->query($sql);
 }
开发者ID:q4z1,项目名称:pokerth_monthlycup,代码行数:8,代码来源:settings.php

示例5: get_all_entries_ordered

 public static function get_all_entries_ordered()
 {
     // debug::add_info("(".__FILE__.")<b>".__CLASS__."</b>::".__FUNCTION__."() betreten.");
     $db = database::get_instance();
     $sql = "\n\t\t\tSELECT r.*, p.awards, p.avatar, p.avatar_mime FROM `ranking2016` r\n      LEFT JOIN `player2016` p USING(playername)\n      WHERE TRUE\n      ORDER by r.crptotal desc;\n\t\t";
     //debug::add_info("sql:<br /><pre>$sql</pre>");
     return $db->get_objects($sql, __CLASS__);
 }
开发者ID:q4z1,项目名称:pokerth_monthlycup,代码行数:8,代码来源:ranking2016.php

示例6: get_points_by_player_month

 public static function get_points_by_player_month($player, $month)
 {
     $db = database::get_instance();
     $player = $db->escape($player);
     $month = $db->escape($month);
     $sql = "\n      SELECT sum(points) as points FROM upload2016\n\t\t\tWHERE \n\t\t\tplayername = '{$player}' AND\n\t\t\tmonth = '{$month}'\n      GROUP BY playername ORDER BY points DESC;\n\t\t";
     //debug::add_info("sql:<br /><pre>$sql</pre>");
     return $db->get_assoc($sql);
 }
开发者ID:q4z1,项目名称:pokerth_monthlycup,代码行数:9,代码来源:upload2016.php

示例7: remove_by_filter

 public static function remove_by_filter($table, $filter = array())
 {
     $db = database::get_instance();
     $query = "\n\t\t\t\tDELETE\n\t\t\t\tFROM\t{$table}\n\t\t\t\tWHERE\tTRUE\n\t\t\t";
     foreach ($filter as $field => $value) {
         $value = $db->escape($value);
         $option = $value == 'NULL' || is_null($value) ? "(`{$field}` IS NULL OR `{$field}` = '0')" : "`{$field}` = '{$value}'";
         $query .= " AND {$option}";
     }
     return $db->query($query);
 }
开发者ID:q4z1,项目名称:pokerth_monthlycup,代码行数:11,代码来源:entry.php

示例8: __construct

 public function __construct()
 {
     $this->db = database::get_instance();
     $this->table = '';
     $this->field = '*';
     $this->where = '';
     $this->order = '';
     $this->page_size = 0;
     $this->page = 1;
     $this->page_sum = 1;
 }
开发者ID:jechiy,项目名称:xiu-cms,代码行数:11,代码来源:table.class.php

示例9: User_login

 public function User_login($table, $col_1, $col_2, $input_1, $input_2, $type)
 {
     $input = Input::all();
     Session::put('table', $table);
     $inputs = array($col_1 => $input[$input_1], $col_2 => $input[$input_2]);
     if (Auth::attempt($inputs)) {
         $object = database::get_instance();
         $val = array('user_session' => $input[$input_1], 'type' => $type);
         $object->add('users_login', $val);
         return Redirect::to('/');
     } else {
         return Redirect::to('/')->with('exists', 'Wrong E-Mail Or Password');
     }
 }
开发者ID:Ahmed-Mohamed1994,项目名称:Grade_System_laravel,代码行数:14,代码来源:SignIn.php

示例10:

 @extends('../includes/sidebar')
 @section('content')

<?php 
/*get the id from session*/
$id = Session::get('update_department');
/*select tha data that id has it*/
$view_department = database::get_instance();
$user = $view_department->view('department', 'where_first', 'id', '=', $id, '');
?>


	<div class="row">
	<div class="col-md-12">

		<div class="panel panel-primary" data-collapsed="0">

			
				

			<div class="panel-heading">
				<div class="panel-title">
					<h2>Update department</h2>
				</div>
			</div>

			<div class="panel-body">

				<form role="form" class="form-horizontal form-groups-bordered" method="post" enctype="multipart/form-data" action="update_department=<?php 
echo $id;
?>
开发者ID:Hassan-Alaa,项目名称:Grade-System,代码行数:31,代码来源:update.blade.php

示例11:

						<th class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">
							Number of course houres
						</th>
						<th class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">
                        	Course Type
                        </th>
                        <th class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">
                        	Action
                        </th>
					</tr>
				</thead>
				
				
				<tbody role="alert" aria-live="polite" aria-relevant="all">
					<?php 
$view_course = database::get_instance();
$courses = $view_course->view('course', ' ', ' ', " ", ' ', '');
foreach ($courses as $dep) {
    $department = $view_course->view('department', "where_first", 'id', '=', "{$dep->department}", '');
    ?>

						        <tr class="gradeA odd">
									<td class=" "><?php 
    echo $dep->id;
    ?>
</td>
									<td class=" "><?php 
    echo $dep->name;
    ?>
</td>
									<td class=" "><?php 
开发者ID:Hassan-Alaa,项目名称:Grade-System,代码行数:31,代码来源:view.blade.php

示例12: download_homework

 public function download_homework($id)
 {
     $object = database::get_instance();
     $user = $object->view("student_assignment", "where_first", 'id', '=', "{$id}", '');
     $name_of_file = $user->student_assignment;
     $file = public_path() . "/assets/assignment_upload/{$name_of_file}";
     $file_name_extension = $name_of_file;
     return Response::download($file, "{$file_name_extension}");
 }
开发者ID:Hassan-Alaa,项目名称:Grade-System,代码行数:9,代码来源:teacher.php

示例13:

		<div class="panel panel-primary" data-collapsed="0">

	<div class="panel-heading">
				<div class="panel-title">
					<h2>View Uploaded Assignment</h2>
				</div>

			</div>
				<div class="panel-body">

                    <div class="row">

                             <?php 
/*select all fields*/
$view_fields = database::get_instance();
$users = DB::table('users_login')->orderBy('id', 'desc')->first();
$id = $view_fields->view('professor', "where_pluck", 'Mail', '=', $users->user_session, 'id');
$courses = $view_fields->view('prof_course', 'where_get', 'prof_id', '=', $id, '', '');
?>




                         					<div class="form-group">
                                             	<label class="col-sm-2 control-label" style="
                                                    margin-top: 9px;
                                                ">All Courses</label>

                                             	<div class="col-sm-9">
开发者ID:Hassan-Alaa,项目名称:Grade-System,代码行数:29,代码来源:grade_field_for_each_student.blade.php

示例14: elseif

 @extends('../includes/sidebar')
 @section('content')
<?php 
$users = DB::table('users_login')->orderBy('id', 'desc')->first();
$mail = $users->user_session;
$person_type = $users->type;
$id = '';
$object = database::get_instance();
$table = '';
if ($person_type == 'Administrator') {
    $table = 'admin';
    $id = $object->view('admin', "where_pluck", 'mail', '=', $mail, 'id');
} elseif ($person_type == 'Professor') {
    $table = 'professor';
    $id = $object->view('professor', "where_pluck", 'Mail', '=', $mail, 'id');
} elseif ($person_type == 'Teacher') {
    $table = 'teacher';
    $id = $object->view('teacher', "where_pluck", 'Mail', '=', $mail, 'id');
} elseif ($person_type == 'Student') {
    $table = 'students';
    $id = $object->view('students', "where_pluck", 'stu_id', '=', $mail, 'id');
}
?>

        	<?php 
$success = Session::get('success');
?>
            @if($success)
            <div class="alert alert-success">
            <center>{{ $success }}</center>
            </div>
开发者ID:Hassan-Alaa,项目名称:Grade-System,代码行数:31,代码来源:profile.blade.php

示例15: upload_solution

 public function upload_solution($id)
 {
     $object = database::get_instance();
     $users = DB::table('users_login')->orderBy('id', 'desc')->first();
     $stu_id = $users->user_session;
     $student_id = $object->view('students', "where_pluck", 'stu_id', '=', $stu_id, 'id');
     $ass_id = Input::get('assignment_id');
     $file = Input::file('upload_assignment');
     $destinationPath = "/wamp/www/GradeSystem/public/assets/assignment_upload";
     $filename = str_random(6) . '_' . $file->getClientOriginalName();
     $uploadSuccess = $file->move($destinationPath, $filename);
     $val = array('student_id' => $student_id, 'assignment_id' => $ass_id, 'student_assignment' => $filename);
     $object->add('student_assignment', $val);
     return Redirect::to("view_student_assignment=" . $id)->with('success', 'You successfully upload assignment.');
 }
开发者ID:Hassan-Alaa,项目名称:Grade-System,代码行数:15,代码来源:student.php


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