本文整理汇总了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();
}