本文整理汇总了PHP中DatabaseConnection::get_db_link方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::get_db_link方法的具体用法?PHP DatabaseConnection::get_db_link怎么用?PHP DatabaseConnection::get_db_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::get_db_link方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DatabaseConnection
</div>';
$isLogged = false;
if (isset($_POST["username"])) {
$usr = $_POST['username'];
$pwd = $_POST['password'];
$isLogged = true;
}
if (isset($_SESSION["username"])) {
$usr = $_SESSION['username'];
$pwd = $_SESSION['password'];
$isLogged = true;
}
if ($isLogged) {
$conn = new DatabaseConnection();
$query = "SELECT * FROM Admin WHERE Username = " . $usr . " AND Password=" . $pwd;
if (!mysqli_query($conn->get_db_link(), $query)) {
$loginMessage = " - Dati incorretti!";
echo $loginFormWitError;
} else {
$_SESSION["username"] = $usr;
$_SESSION["password"] = $pwd;
echo $addProductHTML;
}
} else {
echo $loginForm;
}
?>
<?php
require "footer.php";
?>
示例2: setcookie
}
if (!isset($_COOKIE['orderCriteria'])) {
setcookie('orderCriteria', 'ASC');
$_COOKIE['orderCriteria'] = 'ASC';
}
//Se ho premuto "aggiungi al carrello", ho passato alla pagina un id
require "header.php";
require "../Controller/TileController.php";
require "../Controller/DatabaseConnection.php";
require "../Controller/CatalogRequestsController.php";
?>
<?php
$conn = new DatabaseConnection();
$req = new CatalogRequestsController($conn->get_db_link());
$tileC = new TileController();
$catalogItems = '';
$elemInPage = 12;
// change number also in pagination.js
$visibility = '';
$products = $req->getCatalogArray();
for ($i = 0; $i < sizeof($products); $i++) {
if ($i >= $elemInPage) {
$visibility = 'hidden';
}
$catalogItems = $catalogItems . $tileC->getSmallSquare($visibility, $products[$i]->getId(), $products[$i]->getName(), $products[$i]->getPrice(), $products[$i]->getImage());
}
$turkey = '<div class="catalog-cont">';
$stuffing = $req->getTitleAndPaging(true) . $catalogItems . $req->getTitleAndPaging(false);
echo $tileC->getSearchSection() . $tileC->getDetailedProduct() . $tileC->insertIntoDiv($turkey, $stuffing);
示例3: DatabaseConnection
<?php
require "Controller/DatabaseConnection.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$conn = new DatabaseConnection();
$query = "SELECT * FROM Product";
$prod = mysqli_query($conn->get_db_link(), $query);
while ($row = mysqli_fetch_assoc($prod)) {
echo $row['ID_Prod'] . " " . $row['Name'];
}
mysqli_close($conn->get_db_link());
?>
</body>
</html>
示例4: DatabaseConnection
<?php
/**
* Created by PhpStorm.
* User: albertogiunta
* Date: 25/01/16
* Time: 10:47
*/
session_start();
require "../Controller/DatabaseConnection.php";
require "../Controller/CatalogRequestsController.php";
$conn = new DatabaseConnection();
$req = new CatalogRequestsController($conn->get_db_link());
if (isset($_GET["logout"])) {
if ($_GET["logout"] == "ok") {
$_SESSION["username"] = null;
$_SESSION["password"] = null;
session_destroy();
header("Location: ../View/home.php");
}
}
if (isset($_GET["detailsId"])) {
$details = $req->getDetailedInformation($_GET["detailsId"]);
echo json_encode($req->parseArray($details)[0]);
}
if (isset($_GET["prodName"])) {
$searchResults = $req->getSearchResults($_GET["prodName"]);
$parsedArray = $req->parseArray($searchResults);
$encoded = json_encode($parsedArray);
echo $encoded;
}
示例5: DatabaseConnection
*/
$title = "HOME";
require "header.php";
require "../Controller/TileController.php";
require "../Controller/DatabaseConnection.php";
require "../Controller/HomepageRequestsController.php";
?>
<div class="presentation">
<p>Amigurumi Life è un progetto fondato nel 2012, con base a Padova.</p>
<p>Produciamo piccole perle arricchite di preziosi dettagli, per persone che non si accontentano e che amano trovare la bellezza anche nelle più piccole cose.</p>
</div>
<?php
$conn = new DatabaseConnection();
$req = new HomepageRequestsController($conn->get_db_link());
$tileC = new TileController();
/*
* RECENT PRODUCTS
* */
$recentProducts = $req->getMostRecent();
$turkey = '<div class="recently-added-cont">';
$stuffing = $tileC->getTitle('Aggiunti di recente');
$mostRecent = "";
$lessRecent = "";
for ($i = 0; $i < 3; $i++) {
if (isset($recentProducts[$i])) {
if ($i < 1) {
$mostRecent = $tileC->getLongTileItem('most-recent ', $recentProducts[$i]->getId(), $recentProducts[$i]->getName(), $recentProducts[$i]->getPrice(), $recentProducts[$i]->getDescription(), $recentProducts[$i]->getImage());
} else {
$lessRecent = $lessRecent . $tileC->getShortTileItem($recentProducts[$i]->getId(), $recentProducts[$i]->getName(), $recentProducts[$i]->getPrice(), $recentProducts[$i]->getImage());
示例6: DatabaseConnection
<?php
/**
* Created by PhpStorm.
* User: albertogiunta
* Date: 28/01/16
* Time: 10:40
*/
require "DatabaseConnection.php";
$conn = new DatabaseConnection();
$link = $conn->get_db_link();
$name = mysqli_real_escape_string($link, $_POST["name"]);
$email = mysqli_real_escape_string($link, $_POST["email"]);
$message = mysqli_real_escape_string($link, $_POST["message"]);
date_default_timezone_set('Europe/Rome');
$datetime = date("Y-m-d H:i:s");
$query = "INSERT INTO Contacts (Name, Email, Message, Date) VALUES ('{$name}', '{$email}', '{$message}', '{$datetime}')";
if (!mysqli_query($link, $query)) {
$get = 'failed';
} else {
$get = 'ok';
}
header("Location: ../View/contattaci.php?response=" . $get);