本文整理匯總了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;
}
示例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);
}
}
示例3: open
public static function open($database)
{
if (empty(self::$conn)) {
self::$conn = Connection::open($database);
self::$conn->beginTransaction();
self::$logger = NULL;
}
}
示例4: location
public static function location()
{
$con = Connection::open();
$resultado = $con->query("SELECT * FROM producto");
return $resultado;
}
示例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}' ");
}
示例6: deleteProducto
public static function deleteProducto($selectID)
{
$con = Connection::open();
$con->statement("DELETE FROM producto WHERE id='{$selectID}' ");
}
示例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;
示例8: findAll_talla_producto
public static function findAll_talla_producto()
{
$con = Connection::open();
$resultado = $con->query("SELECT * FROM talla_producto");
return $resultado;
}
示例9: findForSelectID
public static function findForSelectID($select)
{
$con = Connection::open();
$resultado = $con->query("SELECT * FROM talla_producto WHERE producto_id='{$select}' ");
return $resultado;
}
示例10: execute
function execute($query)
{
$conn = new Connection();
$conn->open();
$recordset = $conn->execute($query);
$conn->close();
return $recordset;
}
示例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();
}
示例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;
}