当前位置: 首页>>代码示例>>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;未经允许,请勿转载。