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