我有mydatabase中的雙鏈接問題。 我已經在PHP文件格式的新職位。有$ _POST ['標題'] 當人們提交標題php從標題創建一個新的URL到數據庫。問題是用戶提交的數據庫中已經存在的標題,因爲php創建了雙鏈接。我想編寫一個函數來檢查url,如果它存在,則爲新帖子創建另一個鏈接,例如:if exists/posts/new_link函數創建另一個鏈接,如:/ posts/new_link_1。 我有此代碼:由標題創建的數據庫中的雙鏈接
$link = $_GET['url'];
$checkdb = mysql_query("SELECT `url` FROM `posts` WHERE `url`='$link'") or die("ERROR");
$howmanypost = mysql_num_rows($checkdb); //this is check links in db
if ($howmanypost = $newlinksfromtitle) {
// Here I would like the function that creates a new url to db
} else {
$newpost = "INSERT INTO `posts` (`id`, `title`, `img`, `tags`, `author`, `data`, `type`, `url`) VALUES ('', '$title', '$img', '$tags', '$author', '$data', 'img', '$url')";
$makepost = mysql_query($newpost);
}
對不起,我的英語不好。
好的SQL注入漏洞。 –
現在已經修補 –