本文整理汇总了PHP中DatabaseConnection::connectToDB方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::connectToDB方法的具体用法?PHP DatabaseConnection::connectToDB怎么用?PHP DatabaseConnection::connectToDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::connectToDB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteLocation
public function deleteLocation($id)
{
$db = new DatabaseConnection();
$conn = $db->connectToDB();
$result = $db->updateDatabase("DELETE FROM location where id = {$id}");
$db->closeDBConnection($conn);
header("Content-Type: application/json");
echo json_encode($result);
}
示例2: deleteSuggestion
public function deleteSuggestion($id)
{
$db = new DatabaseConnection();
$conn = $db->connectToDB();
$query = "DELETE from userSuggestions where suggestion_id = {$id}";
$r1 = $db->updateDatabase($query);
$query = "DELETE from venueSuggestions where suggestion_id = {$id}";
$r2 = $db->updateDatabase($query);
$query = "DELETE from suggestion where id = {$id}";
$r3 = $db->updateDatabase($query);
if ($r1 == $r2) {
echo json_encode("Suggestion Deleted");
} else {
echo json_encode("Error Deleting Suggestion");
}
}