本文整理匯總了PHP中DBManager::getConn方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBManager::getConn方法的具體用法?PHP DBManager::getConn怎麽用?PHP DBManager::getConn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBManager
的用法示例。
在下文中一共展示了DBManager::getConn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCourses
function getCourses()
{
$conn = DBManager::getConn();
$stmt = $conn->prepare("SELECT * FROM `course`");
$stmt->execute();
$info = $stmt->fetchAll();
if ($stmt->rowCount() > 0) {
return $info;
} else {
return null;
}
}
示例2: getUserAccountTypeById
function getUserAccountTypeById($user_id)
{
$conn = DBManager::getConn();
$stmt = $conn->prepare("SELECT * FROM `student` WHERE `student_id` = :user_id");
$stmt->bindValue(":user_id", $user_id);
$stmt->execute();
if ($stmt->rowCount() === 1) {
return "Student";
}
$stmt = $conn->prepare("SELECT * FROM `tutor` WHERE `tutor_id` = :user_id");
$stmt->bindValue(":user_id", $user_id);
$stmt->execute();
if ($stmt->rowCount() === 1) {
return "Tutor";
}
return null;
}
示例3: changeProfilePic
function changeProfilePic($user_id, $path)
{
$conn = DBManager::getConn();
$stmt = $conn->prepare("UPDATE `user` SET `profile_pic` = :profile_pic WHERE `user_id` = :user_id");
$stmt->bindValue(":user_id", $user_id);
$stmt->bindValue(":profile_pic", $path);
$stmt->execute();
}
示例4: insertUserMessage
function insertUserMessage($message_id, $uId, $oId, $folder)
{
$conn = DBManager::getConn();
$stmt = $conn->prepare("INSERT INTO `user_messages` (`message_id`, `user_id`, `other_user_id`, `folder`) VALUES (:message_id, :uId, :oId, :folder)");
$stmt->bindValue(":message_id", $message_id);
$stmt->bindValue(":uId", $uId);
$stmt->bindValue(":oId", $oId);
$stmt->bindValue(":folder", $folder);
$stmt->execute();
}