0
我想創建一個在線書籤系統。 我設法從用戶處獲取URL並將其存儲到數據庫中。但我想也採取「標題和標籤」 誰能幫助我的代碼..php書籤
function add_bm($new_url)
{
// Add new bookmark to the database
echo "Attempting to add ".htmlspecialchars($new_url).'<br />';
$valid_user = $_SESSION['valid_user'];
$conn = db_connect();
// check not a repeat bookmark
$result = $conn->query("select * from bookmark
where username='$valid_user'
and bm_URL='$new_url'");
if ($result && ($result->num_rows>0))
throw new Exception('Bookmark already exists.');
// insert the new bookmark
if (!$conn->query("insert into bookmark values
('$valid_user', '$new_url')"))
throw new Exception('Bookmark could not be inserted.');
return true;
}