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


PHP Connection::close_connection方法代码示例

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


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

示例1: load

 public function load($iUserID)
 {
     $connection = new Connection();
     $sSQL = "SELECT UserID, FirstName, LastName, Username, Address, Email, Telephone, Password, Admin\n                     FROM tbuser\n                     WHERE UserID=" . $iUserID;
     $resultSet = $connection->query($sSQL);
     $row = $connection->fetch_array($resultSet);
     //store data into attributes:
     $this->iUserID = $row['UserID'];
     $this->sFirstName = $row['FirstName'];
     $this->sLastName = $row['LastName'];
     $this->sUsername = $row['Username'];
     $this->sAddress = $row['Address'];
     $this->sEmail = $row['Email'];
     $this->iTelephone = $row['Telephone'];
     $this->sPassword = $row['Password'];
     $this->iAdmin = $row['Admin'];
     // get all recipe ids of each user:
     $sSQL = "SELECT RecipeID\n                     FROM tbrecipe\n                     WHERE UserID=" . $iUserID;
     $resultSet = $connection->query($sSQL);
     while ($row = $connection->fetch_array($resultSet)) {
         $iRecipeID = $row["RecipeID"];
         $oRecipe = new Recipe();
         $oRecipe->load($iRecipeID);
         $this->aRecipes[] = $oRecipe;
     }
     $connection->close_connection();
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:27,代码来源:user.php

示例2: get_makes

 public static function get_makes()
 {
     //open connection to MySql
     parent::open_connection();
     //initialize arrays
     $ids = array();
     //array for ids
     $list = array();
     //array for objects
     //query
     $query = "select mak_id from makes";
     //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 Make($ids[$i]));
     }
     //return array
     return $list;
 }
开发者ID:Jczamarripa,项目名称:cars2015,代码行数:32,代码来源:catalogs.php

示例3: 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

示例4: load

 public function load($iOrderID)
 {
     $connection = new Connection();
     $sSQL = "SELECT OrderID, OrderDate, OrderStatus, RecipientName, DeliveryAddress, BillingAddress, Payment, AccountName, CardNumber, ExpiryDate, Security, UserID\n                     FROM tborder\n                     WHERE OrderID=" . $iOrderID;
     $resultSet = $connection->query($sSQL);
     $row = $connection->fetch_array($resultSet);
     //store data in attributes:
     $this->iOrderID = $row["OrderID"];
     $this->tOrderDate = $row["OrderDate"];
     $this->sOrderStatus = $row["OrderStatus"];
     $this->sRecipientName = $row["RecipientName"];
     $this->sDelivery = $row["DeliveryAddress"];
     $this->sBilling = $row["BillingAddress"];
     $this->sPayment = $row["Payment"];
     $this->sAccountName = $row["AccountName"];
     $this->iCardNumber = $row["CardNumber"];
     $this->sExpiry = $row["ExpiryDate"];
     $this->iSecurity = $row["Security"];
     $this->iUserID = $row["UserID"];
     $connection->close_connection();
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:21,代码来源:order.php

示例5: load

 public function load($iSubscriberID)
 {
     $connection = new Connection();
     $sSQL = "SELECT SubscriberID, Email\n                     FROM tbnewsletter\n                     WHERE SubscriberID=" . $iSubscriberID;
     $resultSet = $connection->query($sSQL);
     $row = $connection->fetch_array($resultSet);
     //store data into attributes:
     $this->iSubscriberID = $row['SubscriberID'];
     $this->sEmail = $row['Email'];
     $connection->close_connection();
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:11,代码来源:subscriber.php

示例6: load

 public function load($iLikeID)
 {
     $connection = new Connection();
     $sSQL = "SELECT LikeID, UserID, RecipeID\n\t\t\t         FROM tblike\n\t\t\t         WHERE LikeID = " . $iLikeID;
     $resultSet = $connection->query($sSQL);
     $row = $connection->fetch_array($resultSet);
     // store into attributes:
     $this->iLikeID = $row["LikeID"];
     $this->iUserID = $row["UserID"];
     $this->iRecipeID = $row["RecipeID"];
     $connection->close_connection();
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:12,代码来源:likes.php

示例7: listAllTypes

 public static function listAllTypes()
 {
     // creates associative array
     $aRecipeTypes = array();
     $connection = new Connection();
     $sSQL = "SELECT RecipeTypeID,TypeName\n                     FROM tbrecipetype\n                     ";
     $resultSet = $connection->query($sSQL);
     while ($row = $connection->fetch_array($resultSet)) {
         $iRecipeTypeID = $row['RecipeTypeID'];
         $aRecipeTypes[$iRecipeTypeID] = $row['TypeName'];
     }
     $connection->close_connection();
     return $aRecipeTypes;
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:14,代码来源:recipeTypeManager.php

示例8: getAllProducts

 public static function getAllProducts()
 {
     $aAllProducts = array();
     $connection = new Connection();
     $sSQL = "SELECT ProductID\n                     FROM tbproduct\n                     ORDER BY CreatedAt DESC\n                     ";
     $resultSet = $connection->query($sSQL);
     while ($row = $connection->fetch_array($resultSet)) {
         $iProductID = $row['ProductID'];
         $oProduct = new Product();
         $oProduct->load($iProductID);
         $aAllProducts[] = $oProduct;
     }
     $connection->close_connection();
     return $aAllProducts;
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:15,代码来源:productManager.php

示例9: getAllRecipes

 public static function getAllRecipes()
 {
     $aAllRecipes = array();
     $connection = new Connection();
     $sSQL = "SELECT RecipeID\n                     FROM tbrecipe\n                     ORDER BY CreatedAt DESC\n                     ";
     $resultSet = $connection->query($sSQL);
     while ($row = $connection->fetch_array($resultSet)) {
         $iRecipeID = $row['RecipeID'];
         $oRecipe = new Recipe();
         $oRecipe->load($iRecipeID);
         $aAllRecipes[] = $oRecipe;
     }
     $connection->close_connection();
     return $aAllRecipes;
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:15,代码来源:recipeManager.php

示例10: load

 public function load($iProductID)
 {
     $connection = new Connection();
     $sSQL = "SELECT ProductID, ProductName, Description, Price, Size, Ingredients, StockLevel, ImagePath, CreatedAt\n                     FROM tbproduct\n                     WHERE ProductID=" . $iProductID;
     $resultSet = $connection->query($sSQL);
     $row = $connection->fetch_array($resultSet);
     //store into attributes:
     $this->iProductID = $row["ProductID"];
     $this->sProductName = $row["ProductName"];
     $this->sDescription = $row["Description"];
     $this->fPrice = $row["Price"];
     $this->sSize = $row["Size"];
     $this->sIngredients = $row["Ingredients"];
     $this->iStockLevel = $row["StockLevel"];
     $this->sImagePath = $row["ImagePath"];
     $this->tCreatedAt = $row["CreatedAt"];
     $connection->close_connection();
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:18,代码来源:product.php

示例11: load

 public function load($iID)
 {
     // Open
     $oConnection = new Connection();
     // Extract
     $sSQL = "SELECT ProductID, ProductName, Description, Price, TypeID, PhotoPath\n\t\tFROM tbproduct\n\t\tWHERE ProductID =" . $iID;
     $oResult = $oConnection->query($sSQL);
     // fetch
     $aProduct = $oConnection->fetch_array($oResult);
     $this->iProductID = $aProduct["ProductID"];
     $this->sProductName = $aProduct["ProductName"];
     $this->sDescription = $aProduct["Description"];
     $this->iCost = $aProduct["Price"];
     $this->iTypeID = $aProduct["TypeID"];
     $this->sPhotoPath = $aProduct["PhotoPath"];
     // close
     $oConnection->close_connection();
 }
开发者ID:jfortes,项目名称:isotope,代码行数:18,代码来源:model_product.php

示例12: 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

示例13: save

 public function save()
 {
     $oConnection = new Connection();
     if ($this->bExisting == false) {
         $sSQL = "INSERT INTO tbcustomer(FirstName, LastName, Address, Telephone, Email, UserName, Password\n\t\t\t\t)\n\t\t\tVALUES (\n\t\t\t\t'" . $oConnection->escape_value($this->sFirstName) . "',\n\t\t\t\t'" . $oConnection->escape_value($this->sLastName) . "',\n\t\t\t\t'" . $oConnection->escape_value($this->sAddress) . "',\n\t\t\t\t'" . $oConnection->escape_value($this->sTelephone) . "',\n\t\t\t\t'" . $oConnection->escape_value($this->sEmail) . "',\n\t\t\t\t'" . $oConnection->escape_value($this->sUserName) . "',\n\t\t\t\t'" . $oConnection->escape_value($this->sPassword) . "'\n\t\t\t\t)";
         $bResult = $oConnection->query($sSQL);
         if ($bResult == true) {
             $this->iCustomerID = $oConnection->get_insert_id();
             $this->bExisting = true;
         } else {
             die($sSQL . "failed");
         }
     } else {
         // updating current customer
         $sSQL = "UPDATE tbcustomer\n\t\t\tSET FirstName = '" . $oConnection->escape_value($this->sFirstName) . "', \n\t\t\tLastName = '" . $oConnection->escape_value($this->sLastName) . "',\n\t\t\tAddress = '" . $oConnection->escape_value($this->sAddress) . "', \n\t\t\tTelephone = '" . $oConnection->escape_value($this->sTelephone) . "',\n\t\t\tEmail = '" . $oConnection->escape_value($this->sEmail) . "',\n\t\t\tUserName = '" . $oConnection->escape_value($this->sUserName) . "',\n\t\t\tPassword = '" . $oConnection->escape_value($this->sPassword) . "'\n\t\t\tWHERE tbcustomer.CustomerID =" . $oConnection->escape_value($this->iCustomerID);
         $bResult = $oConnection->query($sSQL);
         if ($bResult == false) {
             die($sSQL . "fails");
         }
     }
     $oConnection->close_connection();
 }
开发者ID:jfortes,项目名称:isotope,代码行数:22,代码来源:model_customer.php

示例14: 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

示例15: load

 public function load($iRecipeTypeID)
 {
     $connection = new Connection();
     $sSQL = "SELECT RecipeTypeID, TypeName, Description, DisplayOrder\n                     FROM tbrecipetype\n                     WHERE RecipeTypeID=" . $iRecipeTypeID;
     $resultSet = $connection->query($sSQL);
     $row = $connection->fetch_array($resultSet);
     //store into data attribues:
     $this->iRecipeTypeID = $row["RecipeTypeID"];
     $this->sTypeName = $row["TypeName"];
     $this->sDescription = $row["Description"];
     $this->iDisplayOrder = $row["DisplayOrder"];
     // get all recipe IDs of type:
     $sSQL = "SELECT RecipeID\n                     FROM tbrecipe\n                     WHERE RecipeTypeID=" . $iRecipeTypeID . "\n                     ORDER BY CreatedAt DESC";
     $resultSet = $connection->query($sSQL);
     while ($row = $connection->fetch_array($resultSet)) {
         $iRecipeID = $row['RecipeID'];
         $oRecipe = new Recipe();
         $oRecipe->load($iRecipeID);
         $this->aRecipes[] = $oRecipe;
     }
     $connection->close_connection();
 }
开发者ID:leanne-abarro,项目名称:getInMyBelly,代码行数:22,代码来源:recipeType.php


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