本文整理汇总了PHP中DBConnection::ExecuteSelectQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnection::ExecuteSelectQuery方法的具体用法?PHP DBConnection::ExecuteSelectQuery怎么用?PHP DBConnection::ExecuteSelectQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnection
的用法示例。
在下文中一共展示了DBConnection::ExecuteSelectQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetComputersByLab
/**
* Gets the computers of the asked lab
*/
public static function GetComputersByLab($lab_id)
{
$sql = "select * from Computers where LabID = " . $lab_id . " order by X1, Y1;";
$results = DBConnection::ExecuteSelectQuery($sql);
$computers = self::GetArrayFromDBTable($results);
return $computers;
}
示例2: Load
public static function Load($user_name, $password)
{
$user_name = addslashes(stripslashes($user_name));
$password = md5($password);
$sql = "select *\n\t\t\t\t\tfrom Users\n\t\t\t\t\twhere\n\t\t\t\t\t\t(UserName = '" . $user_name . "') and\n\t\t\t\t\t\t(Password = '" . $password . "');";
$results = DBConnection::ExecuteSelectQuery($sql);
if (count($results) == 0) {
return null;
}
$row = $results[0];
if ($row["DateActivated"] == null) {
$date_activated = null;
} else {
$date_activated = new DateTime($row["DateActivated"]);
}
$user = new User((int) $row["ID"], $row["UserName"], $row["CsUser"], (int) $row["Warnnings"], $row["ActivationKey"], $date_activated, new DateTime($row["DateAdded"]));
return $user;
}
示例3: GetLabsOccupancy
public static function GetLabsOccupancy()
{
$sql = "select\n\t\t\t\t\tLabs.ID as LabID,\n\t\t\t\t\tLabs.Capacity,\n\t\t\t\t\t(\n\t\t\t\t\t\tselect count(Computers.LabID)\n\t\t\t\t\t\tfrom Computers\n\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t(Computers.LabID = Labs.ID) and\n\t\t\t\t\t\t\t((Computers.StatusID = 2) or (Computers.StatusID = 3))\n\t\t\t\t\t) as TotalUsed\n\t\t\t\tfrom Labs;";
$results = DBConnection::ExecuteSelectQuery($sql);
return $results;
}
示例4: ini_set
<?php
ini_set("display_errors", 1);
require_once "classes/db_connection.php";
$sql = "select * from Computers;";
$results = null;
try {
DBConnection::Connect();
$results = DBConnection::ExecuteSelectQuery($sql);
} catch (Exception $ex) {
}
if ($results != null) {
foreach ($results as $row) {
echo $row["ID"] . $row["ComputerName"] . "<br />";
}
}
DBConnection::Close();
?>
done.