本文整理汇总了PHP中DBConnect::GetConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnect::GetConnection方法的具体用法?PHP DBConnect::GetConnection怎么用?PHP DBConnect::GetConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnect
的用法示例。
在下文中一共展示了DBConnect::GetConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckLogin
function CheckLogin($login)
{
$err;
if (strlen($login) < 3) {
$err .= "Niks nedrīkst būt mazāks par 3 simboliem\n";
}
if (strlen($login) > 25) {
$err .= "Niks nedrīkst būt lielāks par 25 simboliem\n";
}
$link = DBConnect::GetConnection();
$sql = "SELECT * FROM users WHERE `login`='{$login}'";
$result = $link->query($sql);
if ($result->num_rows > 0) {
$err .= "Niks jau ir aizņemts";
}
mysqli_close($link);
return $err;
}
示例2: session_start
<?php
session_start();
require_once "../system.php";
User::CheckLogin();
$id = $_SESSION["id"];
$link = DBConnect::GetConnection();
$sql = "SELECT * FROM users WHERE `id`='{$id}'";
$result = $link->query($sql);
$row = $result->fetch_array(MYSQLI_ASSOC);
?>
<section>
<h1 class="win-h1">Čau, <?php
echo $row["vards"] . " " . $row["uzvards"];
?>
<a class="logoff" href="Content/logoff.php">(Iziet)</a></h1>
<h2 class="win-h3">Tavi dati</h2>
<address>
<p>Tavs niks ir <?php
echo $row["login"];
?>
</p>
<p>Tavs tālrunis ir <?php
echo $row["talrunis"];
?>
</p>
<p>Tavs e-pasts ir <?php
echo $row["epasts"];
?>
</p>
</address>
示例3: RegisterUserModules
public function RegisterUserModules()
{
$link = DBConnect::GetConnection();
$sql = "SELECT * FROM modules";
$result = $link->query($sql);
while ($row = $result->fetch_assoc()) {
$name = $row["name"];
$url = "Content/page.php?name=" . $row["name"];
$fn = $row["friendly_name"];
$icon = $row["icon"];
$gv = (bool) $row["guest_visible"] ? true : false;
$uv = true;
$system = false;
$editable = true;
$mod = new Module($url, $name, $fn, $icon, $gv, $uv, $system, $editable);
$this->menu[] = $mod;
}
mysqli_close($link);
}