當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::open_connection方法代碼示例

本文整理匯總了PHP中Connection::open_connection方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::open_connection方法的具體用法?PHP Connection::open_connection怎麽用?PHP Connection::open_connection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Connection的用法示例。


在下文中一共展示了Connection::open_connection方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_models

 public function get_models()
 {
     //open connection to MySql
     parent::open_connection();
     //initialize arrays
     $ids = array();
     //array for ids
     $list = array();
     //array for objects
     //query
     $query = "select mod_id from models where mod_id_make = ?";
     //prepare command
     $command = parent::$connection->prepare($query);
     //bind params
     $command->bind_param('i', $this->id);
     //execute command
     $command->execute();
     //link results
     $command->bind_result($id);
     //fill ids array
     while ($command->fetch()) {
         array_push($ids, $id);
     }
     //close command
     mysqli_stmt_close($command);
     //close connection
     parent::close_connection();
     //fill object array
     for ($i = 0; $i < count($ids); $i++) {
         array_push($list, new Model($ids[$i]));
     }
     //return array
     return $list;
 }
開發者ID:Jczamarripa,項目名稱:cars2015,代碼行數:34,代碼來源:make.php

示例2: RecordNotFoundException

 function __construct()
 {
     if (func_num_args() == 0) {
         $this->id = '';
         $this->name = '';
         $this->description = '';
         $this->dosification = '';
         $this->peridiocity = "";
     }
     if (func_num_args() == 1) {
         $args = func_get_args();
         $id = $args[0];
         parent::open_connection();
         $query = "select schedule_id, schedule_name, schedule_note from Activities_Schedule where schedule_id = ?";
         $command = parent::$connection->prepare($query);
         $command->bind_param('s', $id);
         $command->execute();
         $command->bind_result($this->id, $this->name, $this->description);
         $found = $command->fetch();
         mysqli_stmt_close($command);
         parent::close_connection();
         if (!$found) {
             throw new RecordNotFoundException();
         }
     }
 }
開發者ID:HogiQuin,項目名稱:CIALAC,代碼行數:26,代碼來源:activity.php

示例3: array

 function get_teams()
 {
     //open connection to Mysql
     parent::open_connection();
     //initialize array_sum
     $ids = array();
     //array for ids
     $list = array();
     //array for objects
     //query
     $query = "select team_id from teams where team_id_div = ?";
     //prepare command
     $command = parent::$connection->prepare($query);
     //link parameters
     $command->bind_param('s', $this->id);
     //execute command
     $command->execute();
     //link results
     $command->bind_result($id);
     //fill ids array
     while ($command->fetch()) {
         array_push($ids, $id);
     }
     //close command
     mysqli_stmt_close($command);
     //close connection
     parent::close_connection();
     //fill object array
     for ($i = 0; $i < count($ids); $i++) {
         array_push($list, new Team($ids[$i]));
     }
     //return array
     return $list;
 }
開發者ID:rickypin8,項目名稱:oop02,代碼行數:34,代碼來源:division.php

示例4: get_tutors

 public static function get_tutors()
 {
     //open connection to MySql
     parent::open_connection();
     //initialize arrays
     $ids = array();
     //array for ids
     $list = array();
     //array for objects
     //query
     $query = "select person_id from Persons_Person";
     //prepare command
     $command = parent::$connection->prepare($query);
     //execute command
     $command->execute();
     //link results
     $command->bind_result($id);
     //fill ids array
     while ($command->fetch()) {
         array_push($ids, $id);
     }
     //close command
     mysqli_stmt_close($command);
     //close connection
     parent::close_connection();
     //fill object array
     for ($i = 0; $i < count($ids); $i++) {
         array_push($list, new Person($ids[$i]));
     }
     //return array
     return $list;
 }
開發者ID:HogiQuin,項目名稱:CIALAC,代碼行數:32,代碼來源:catalogs.php

示例5: get_childs

 public function get_childs()
 {
     parent::open_connection();
     $ids = array();
     $list = array();
     $query = "select child_id from Therapies_Therapy_Child where therapy_id = ?";
     $command = parent::$connection->prepare($query);
     $command->bind_param('s', $this->id);
     $command->execute();
     $command->bind_result($id);
     while ($command->fetch()) {
         array_push($ids, $id);
     }
     mysqli_stmt_close($command);
     parent::close_connection();
     for ($i = 0; $i < count($ids); $i++) {
         array_push($list, new Child($ids[$i]));
     }
     return $list;
 }
開發者ID:HogiQuin,項目名稱:CIALAC,代碼行數:20,代碼來源:therapy.php

示例6: get_activities

 public function get_activities()
 {
     parent::open_connection();
     $ids = array();
     $list = array();
     $query = "select schedule_id from Activities_Schedule_Days where schedule_id = ?";
     $command = parent::$connection->prepare($query);
     $command->bind_param('i', $this->id);
     $command->execute();
     $command->bind_result($id);
     while ($command->fetch()) {
         array_push($ids, $id);
     }
     mysqli_stmt_close($command);
     parent::close_connection();
     for ($i = 0; $i < count($ids); $i++) {
         array_push($list, new Activity($ids[$i]));
     }
     return $list;
 }
開發者ID:HogiQuin,項目名稱:CIALAC,代碼行數:20,代碼來源:schedule.php

示例7: RecordNotFoundException

 function __construct()
 {
     //if no arguments received, create empty object
     if (func_num_args() == 0) {
         $this->id = 0;
         $this->name = '';
         $this->number = '';
         $this->image = '';
         $this->pos_id = '';
     }
     //if one argument received create object with data
     if (func_num_args() == 1) {
         //receive arguments into an array
         $args = func_get_args();
         //id
         $id = $args[0];
         //open connection to Mysql
         parent::open_connection();
         //query
         $query = "select player_id, player_name, player_number,player_image, player_pos_id from players where player_id = ?";
         //prepare command
         $command = parent::$connection->prepare($query);
         //link parameters
         $command->bind_param('i', $id);
         //execute command
         $command->execute();
         //link results to class attributes
         $command->bind_result($this->id, $this->name, $this->number, $this->image, $this->pos_id);
         //fetch data
         $found = $command->fetch();
         //close command
         mysqli_stmt_close($command);
         //close connection
         parent::close_connection();
         //if not found throw exception
         if (!$found) {
             throw new RecordNotFoundException();
         }
     }
 }
開發者ID:HogiQuin,項目名稱:oop02,代碼行數:40,代碼來源:player.php

示例8: RecordNotFoundException

 function __construct()
 {
     //if no arguments received, create empty object
     if (func_num_args() == 0) {
         $this->id = '';
         $this->name = '';
         $this->password = '';
     }
     //if two argument received create object with data
     if (func_num_args() == 2) {
         //receive arguments into an array
         $args = func_get_args();
         //get arguments
         $id = $args[0];
         $password = $args[1];
         //open connection to MySql
         parent::open_connection();
         //query
         $query = "select usr_id, usr_name from users\n\t\t\t\t\t\t\t\t\twhere usr_id = ? and usr_password = sha1(?);";
         //prepare command
         $command = parent::$connection->prepare($query);
         //link parameters
         $command->bind_param('ss', $id, $password);
         //execute command
         $command->execute();
         //link results to class attributes
         $command->bind_result($this->id, $this->name);
         //fetch data
         $found = $command->fetch();
         //close command
         mysqli_stmt_close($command);
         //close connection
         parent::close_connection();
         //if not found throw exception
         if (!$found) {
             throw new RecordNotFoundException();
         }
     }
 }
開發者ID:Jczamarripa,項目名稱:cars2015,代碼行數:39,代碼來源:user.php

示例9: RecordNotFoundException

 function __construct()
 {
     if (func_num_args() == 0) {
         $this->id = '';
         $this->name = '';
     }
     if (func_num_args() == 1) {
         $args = func_get_args();
         $id = $args[0];
         parent::open_connection();
         $query = "select day_id, day_name from Activities_Days where day_id = ?";
         $command = parent::$connection->prepare($query);
         $command->bind_param('i', $id);
         $command->execute();
         $command->bind_result($this->id, $this->name);
         $found = $command->fetch();
         mysqli_stmt_close($command);
         parent::close_connection();
         if (!$found) {
             throw new RecordNotFoundException();
         }
     }
 }
開發者ID:HogiQuin,項目名稱:CIALAC,代碼行數:23,代碼來源:day.php

示例10: get_dosification

 public function get_dosification()
 {
     parent::open_connection();
     $query = "select dosification from Medicines_Medicine_Child where medicine_id = ?";
     $command = parent::$connection->prepare($query);
     $command->bind_param('s', $this->id);
     $command->execute();
     $command->bind_result($id);
     $command->fetch();
     mysqli_stmt_close($command);
     parent::close_connection();
     return $id;
 }
開發者ID:HogiQuin,項目名稱:CIALAC,代碼行數:13,代碼來源:medicine.php

示例11: get_transporter

 public function get_transporter()
 {
     parent::open_connection();
     $query = "select child_transporter_id from Persons_Child where child_tutor_id = ?";
     $command = parent::$connection->prepare($query);
     $command->bind_param('s', $this->id);
     $command->execute();
     $command->bind_result($id);
     $command->fetch();
     mysqli_stmt_close($command);
     parent::close_connection();
     return $id;
 }
開發者ID:HogiQuin,項目名稱:CIALAC,代碼行數:13,代碼來源:person.php

示例12: count

 function get_car_count($min_year, $max_year, $min_price, $max_price)
 {
     //open connection to MySql
     parent::open_connection();
     //query
     $query = 'select count(*) from cars where car_id_model = ?';
     if ($min_year != null) {
         $query .= ' and car_year >= ' . $min_year;
     }
     if ($max_year != null) {
         $query .= ' and car_year <= ' . $max_year;
     }
     if ($min_price != null) {
         $query .= ' and car_price >= ' . $min_price;
     }
     if ($max_price != null) {
         $query .= ' and car_price <= ' . $max_price;
     }
     //prepare command
     $command = parent::$connection->prepare($query);
     //parameters
     $command->bind_param('s', $this->id);
     //execute command
     $command->execute();
     //link results
     $command->bind_result($count);
     //read count
     $command->fetch();
     //close command
     mysqli_stmt_close($command);
     //close connection
     parent::close_connection();
     //return count
     return $count;
 }
開發者ID:Jczamarripa,項目名稱:cars2015,代碼行數:35,代碼來源:model.php


注:本文中的Connection::open_connection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。