本文整理匯總了PHP中DBConnector::getConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBConnector::getConnection方法的具體用法?PHP DBConnector::getConnection怎麽用?PHP DBConnector::getConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBConnector
的用法示例。
在下文中一共展示了DBConnector::getConnection方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCareerByID
public static function getCareerByID($id)
{
$resRow = array();
$query_str = 'SELECT * FROM ' . Titles::$CAREER_TABLE_NAME . ' WHERE ' . Titles::$CAREER_ID . ' = ' . $id . '';
$conn = DBConnector::getConnection();
$resRow = $conn->query($query_str);
$newList = $resRow->fetch();
return $newList;
}
示例2: registerClient
public static function registerClient($name, $surname, $email, $password, $card)
{
$dataBase = DBConnector::getConnection();
$card = self::getCardId($card);
$sql = "INSERT INTO CLIENT (client_name, client_surname, client_email, client_password, card_id) VALUES ('{$name}', '{$surname}', '{$email}', '{$password}', '{$card}' )";
$result = $dataBase->query($sql);
if ($result == 'true') {
echo "Ваши данные успешно добавлены";
} else {
echo $sql . '<br/>';
echo "Ваши данные не добавлены" . '<br/>';
var_dump($result);
}
}
示例3: getLoginData
private static function getLoginData()
{
$newList = array();
$conn = DBConnector::getConnection();
$resultSet = $conn->query('Select * From Admins');
if ($conn != null) {
$i = 0;
while ($row = $resultSet->fetch()) {
$newList[$i][Titles::$USER_LOGIN] = $row['login'];
$newList[$i][Titles::$USER_PASSWORD] = $row['password'];
$i++;
}
}
return $newList;
}
示例4: showAllArticles
public static function showAllArticles()
{
$dataList = array();
$resultSet = null;
$query = 'SELECT * FROM ' . Titles::$ARTICLE_TABLE_NAME . ';';
$connection = DBConnector::getConnection();
$resultSet = $connection->query($query);
if ($connection != null) {
if ($resultSet != null) {
$i = 0;
}
while ($row = $resultSet->fetch()) {
$dataList[$i][Titles::$ARTICLE_TITLE] = $row[Titles::$ARTICLE_TITLE];
$dataList[$i][Titles::$ARTICLE_TEXT_DATA] = $row[Titles::$ARTICLE_TEXT_DATA];
$dataList[$i][Titles::$ARTICLE_PUBLICATION_DATE] = $row[Titles::$ARTICLE_PUBLICATION_DATE];
$i++;
}
}
return $dataList;
}
示例5: getBooksList
public static function getBooksList()
{
include_once src_path . '/classes/Book/Book.php';
$booksList = array();
$dataBase = DBConnector::getConnection();
$result = $dataBase->query('SELECT * from book ORDER BY book_id');
$i = 0;
while ($row = $result->fetch()) {
$booksList[$i]['book_id'] = $row['book_id'];
$booksList[$i]['book_name'] = $row['book_name'];
$booksList[$i]['author_id'] = $row['author_id'];
$booksList[$i]['book_publish_date'] = $row['book_publish_date'];
$booksList[$i]['genre_id'] = $row['genre_id'];
// $booksList[$i]['book_location'] = $row['book_location'];
// $booksList[$i]['book_creation'] = $row['book_creation'];
// $booksList[$i]['book_update'] = $row['book_update'];
$i++;
}
return $booksList;
}
示例6: __construct
public function __construct()
{
$this->connection = DBConnector::getConnection();
}