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


PHP Connection::open方法代碼示例

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


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

示例1: generateKey

 public function generateKey()
 {
     $key = "00000";
     $db = new Connection();
     $conn = $db->open();
     $sql = "SELECT id, `key` FROM urlmapping ORDER BY id DESC LIMIT 1";
     $result = $conn->query($sql);
     if ($result->num_rows > 0) {
         while ($row = $result->fetch_assoc()) {
             $key = $row["key"];
         }
     }
     for ($i = 4; $i >= 0; $i--) {
         $ascii = ord($key[$i]);
         if ($ascii < 122) {
             if ($ascii == 57) {
                 $ascii = 65;
             } else {
                 if ($ascii == 90) {
                     $ascii = 97;
                 } else {
                     $ascii++;
                 }
             }
             $key[$i] = chr($ascii);
             break;
         }
         $key[$i] = '0';
     }
     $conn->close();
     return $key;
 }
開發者ID:prayogo,項目名稱:UrlShort,代碼行數:32,代碼來源:UrlData.php

示例2: open

 public static function open($database)
 {
     // abre uma conex�o e armazena na propriedade est�tica $conn
     if (empty(self::$conn)) {
         self::$conn = Connection::open($database);
     }
 }
開發者ID:habb0,項目名稱:mobbo,代碼行數:7,代碼來源:Transaction.class.php

示例3: open

 public static function open($database)
 {
     if (empty(self::$conn)) {
         self::$conn = Connection::open($database);
         self::$conn->beginTransaction();
         self::$logger = NULL;
     }
 }
開發者ID:jmoliver,項目名稱:php-programando-com-orientacao-a-objeto,代碼行數:8,代碼來源:Transaction.php

示例4: location

 public static function location()
 {
     $con = Connection::open();
     $resultado = $con->query("SELECT * FROM producto");
     return $resultado;
 }
開發者ID:worker-8,項目名稱:PaginaClienteMarcel_VENTA-ROPA,代碼行數:6,代碼來源:url.php

示例5: updateColor

 public static function updateColor($id, $selectID, $color_id)
 {
     $con = Connection::open();
     $con->statement("UPDATE color_producto SET id='{$id}' , producto_id='{$selectID}' ,\n\t\t\t\t\t\t\t color_id='{$color_id}' WHERE id='{$id}' AND producto_id='{$selectID}' ");
 }
開發者ID:worker-8,項目名稱:PaginaClienteMarcel_VENTA-ROPA,代碼行數:5,代碼來源:color_manager.php

示例6: deleteProducto

 public static function deleteProducto($selectID)
 {
     $con = Connection::open();
     $con->statement("DELETE FROM producto WHERE id='{$selectID}' ");
 }
開發者ID:worker-8,項目名稱:PaginaClienteMarcel_VENTA-ROPA,代碼行數:5,代碼來源:productoManager.php

示例7: Connection

DISCLAIMED. IN NO EVENT SHALL ADRIAN KOSMACZEWSKI BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// The binary plist and the SOAP formatters require huge amounts of memory!
ini_set('memory_limit', '128M');
require_once 'data/database.php';
require_once 'formatters/formatterfactory.php';
// Get all the data from the database
$limit = $_GET["limit"];
if (!$limit) {
    $limit = "50";
}
// Before calling mysql_real_escape_string() you have to connect to the DB...!
$conn = new Connection();
$conn->open();
$query = "SELECT * FROM data ORDER BY RAND() LIMIT " . mysql_real_escape_string($limit);
$data = $conn->execute($query);
$conn->close();
// Depending the "format" parameter in the query string,
// output the data in different formats
$format = mysql_real_escape_string($_GET["format"]);
$formatter = FormatterFactory::createFormatter($format);
$formatter->setData($data);
header('Content-type: ' . $formatter->getContentType());
$output = $formatter->formatData();
echo $output;
開發者ID:rotten4pple,項目名稱:iPhoneWebServicesClient,代碼行數:31,代碼來源:index.php

示例8: findAll_talla_producto

 public static function findAll_talla_producto()
 {
     $con = Connection::open();
     $resultado = $con->query("SELECT * FROM talla_producto");
     return $resultado;
 }
開發者ID:worker-8,項目名稱:PaginaClienteMarcel_VENTA-ROPA,代碼行數:6,代碼來源:talla_manager.php

示例9: findForSelectID

 public static function findForSelectID($select)
 {
     $con = Connection::open();
     $resultado = $con->query("SELECT * FROM talla_producto WHERE producto_id='{$select}' ");
     return $resultado;
 }
開發者ID:worker-8,項目名稱:PaginaClienteMarcel_VENTA-ROPA,代碼行數:6,代碼來源:imagen_manager.php

示例10: execute

function execute($query)
{
    $conn = new Connection();
    $conn->open();
    $recordset = $conn->execute($query);
    $conn->close();
    return $recordset;
}
開發者ID:rotten4pple,項目名稱:iPhoneWebServicesClient,代碼行數:8,代碼來源:database.php

示例11: Produto

<?php

require_once 'classes/ar/Produto.php';
require_once 'classes/api/Connection.php';
try {
    $conn = Connection::open('estoque');
    Produto::setConnection($conn);
    $pro = new Produto();
    $pro->descricao = 'Café torrado e moído brasileiro';
    $pro->estoque = 100;
    $pro->preco_custo = 4;
    $pro->preco_venda = 7;
    $pro->codigo_barras = '34963045930455';
    $pro->data_cadastro = date('Y-m-d');
    $pro->origem = 'N';
    $pro->save();
} catch (Exception $e) {
    print $e->getMessage();
}
開發者ID:jmoliver,項目名稱:php-programando-com-orientacao-a-objeto,代碼行數:19,代碼來源:exemplo_conexao.php

示例12: newConnection

 /**
  * Create a default connection object
  */
 protected function newConnection()
 {
     $config = $this->config->getGroupConfig();
     $connection = new Connection($config);
     if (isset($config['stricton']) && $config['stricton'] == TRUE) {
         $connection->open();
         $connection->query('SET SESSION sql_mode="STRICT_ALL_TABLES"');
     }
     return $connection;
 }
開發者ID:vigm,項目名稱:advancedMD,代碼行數:13,代碼來源:Database.php


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