本文整理汇总了PHP中connection类的典型用法代码示例。如果您正苦于以下问题:PHP connection类的具体用法?PHP connection怎么用?PHP connection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了connection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RemoveAuction
function RemoveAuction($config, $jsonResult)
{
$id = $_GET['auction_id'];
$conn = new connection($config);
$jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
$conn->query("DELETE FROM allegro where auction_id='" . $id . "';");
}
示例2: AddProduct
function AddProduct($config, $jsonResult)
{
$cargo_id = $_GET["cargo_id"];
$kind_id = "";
$kind = $_GET["kind"];
$amount = $_GET["amount"];
$sql1 = "SELECT COUNT(name) as kind_amount , kind_id FROM kind WHERE name = '" . $kind . "';";
$sql2 = "INSERT INTO kind(name) VALUES('" . $kind . "')";
$conn = new connection($config);
$jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
try {
$result1 = $conn->query($sql1);
foreach ($result1 as $row) {
if ($row['kind_amount'] === "0") {
$conn->query($sql2);
$kind_id = $conn->conn->lastInsertId();
} else {
$kind_id = $row['kind_id'];
}
}
$conn->query("INSERT INTO product(cargo_id , amount , kind_id) VALUES(" . $cargo_id . " , " . $amount . " , " . $kind_id . ")");
$product_id = $conn->conn->lastInsertId();
$jsonResult->json_data['result_data'] = $product_id;
} catch (PDOException $e) {
$jsonResult->json_data['result_code'] = JSON::$resultCodes['mysql_exception'];
}
}
示例3: fetchOne
public static function fetchOne($sql)
{
$con = new connection();
$con->execute($sql);
$con->fetch();
return $con->rows;
}
示例4: the_cat
function the_cat($by_name = null, $linked = null)
{
if ($this->is_object()) {
if (!empty($this->cat)) {
// Gibt die ID der Kategorie zurück
if (null == $by_name) {
return $this->cat;
// Gibt den Titel der Kategorie zurück
} else {
$db = new connection();
$get_the_catname = $db->query('SELECT * FROM object WHERE id=' . $this->cat);
$the_catname = $db->fetch_array();
if (null !== $linked) {
// Kategorie wird als Link ausgegeben
return '<a href="./?cat=' . $the_catname['id'] . '" rel="nofollow">' . $the_catname['title'] . '</a> ';
} else {
// Kategorie wird nicht als Link ausgegeben
return $the_catname['title'] . " ";
}
}
} else {
return false;
}
}
}
示例5: has_items
function has_items($id)
{
$db = new connection();
$db->query('SELECT * FROM object WHERE type="page" AND status=1 AND parent_id=' . $id);
if ($this->has_child($id)) {
?>
<ul class="submenu">
<?php
}
while ($result = $db->fetch_array()) {
?>
<li><a href='./?page_id=<?php
echo $result['id'];
?>
'><?php
echo $result['menu_title'];
?>
</a>
<?php
if ($this->has_items($result['id'])) {
echo $this->has_items($result['id']);
}
?>
</li>
<?php
}
if ($this->has_child($id)) {
?>
</ul>
<?php
}
}
示例6: getRowCount
public static function getRowCount()
{
$con = new connection();
$connection = $con->getConnection();
$query = "select * from manufacturer";
$result = $connection->query($query) or die(mysqli_error($connection));
return mysqli_num_rows($result) + 10;
}
示例7: dateExists
function dateExists()
{
$date = date('Y-m-d', strtotime($_GET['date']));
$sql = "SELECT COUNT(*) AS count FROM ipodate WHERE ipodate = '" . mysql_escape_string($date) . "'";
$con = new connection();
$con->execute($sql);
die($con->fetch());
}
示例8: uploadFile
public function uploadFile($uploadclassObj)
{
$fileid = $uploadclassObj->getFileid();
$upload_filename = $uploadclassObj->getFilename();
$con = new connection();
$connection = $con->getConnection();
$query = "insert into uploads values(null, '{$fileid}', '{$upload_filename}')";
$result = $connection->query($query) or die(mysqli_error($connection));
}
示例9: getUserByName
public function getUserByName($name)
{
$con = new connection();
$db = $con->getConnection();
$sql = "SELECT * FROM user WHERE name=" . $name;
foreach ($db->query($sql) as $row) {
$user[] = array('id' => $row['id'], 'name' => $row['name'], 'password' => $row['password'], 'mail' => $row['mail'], 'adresse' => $row['adresse'], 'tel' => $row['tel']);
}
}
示例10: GetAuctionList
function GetAuctionList($config, $jsonResult)
{
$conn = new connection($config);
$jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
$result = $conn->query("SELECT auction_id , name , sandbox FROM allegro;");
foreach ($result as $row) {
array_push($jsonResult->json_data['result_data'], array('id' => $row['auction_id'], 'name' => $row['name'], 'sandbox' => $row['sandbox']));
}
}
示例11: GetCargoName
function GetCargoName($config, $jsonResult)
{
$cargo_id = $_GET['cargo_id'];
$conn = new connection($config);
$result = $conn->query("SELECT name FROM cargo WHERE cargo_id = " . $cargo_id . ";");
foreach ($result as $row) {
array_push($jsonResult->json_data["result_data"], $row['name']);
}
$jsonResult->json_data["result_code"] = JSON::$resultCodes['ok'];
}
示例12: AddCargo
function AddCargo($config, $jsonResult)
{
$name = $_GET['name'];
$conn = new connection($config);
$jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
try {
$conn->query("INSERT INTO cargo(name) VALUES('" . $name . "');");
} catch (PDOException $e) {
$jsonResult->json_data['result_code'] = JSON::$resultCodes['mysql_exception'];
}
}
示例13: useralive
function useralive($userid)
{
$con= new connection();
$con->execute("select time from users where iduser='$userid'");
$con->fetch();
$time1= $con->rows['time'];
if ($time1<(time()-13))
return false;
else
return true;
}
示例14: getSymbols
function getSymbols()
{
// get the full list of IPOs in the database
$sql = "SELECT DISTINCT symbol FROM ipo";
$con = new connection();
$con->execute($sql);
$symbols = array();
while ($con->fetch()) {
$symbols[] = $con->rows["symbol"];
}
return $symbols;
}
示例15: getCargoListWithKinds
function getCargoListWithKinds($config, $jsonResult)
{
$conn = new connection(new Config(null, null));
$result = array();
$cargoes = $conn->query("SELECT * FROM cargo");
foreach ($cargoes as $cargo) {
$kinds = $conn->query("SELECT DISTINCT kind.name\n FROM product INNER JOIN kind on product.kind_id = kind.kind_id\n WHERE cargo_id =" . $cargo['cargo_id']);
$kinds = $kinds->fetchAll();
array_push($result, array('name' => $cargo['name'], 'kinds' => $kinds));
}
$jsonResult->json_data['result_data'] = $result;
}