1
哎,我想在我的數據庫中插入一個嵌入代碼,和它給我這個錯誤插入嵌入代碼
Error adding new data: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'movie.php?id=6001',
type = 'stream',
embed = '<object width=\"500\" he' at line 1
現在這是我使用的代碼:
$sql = "INSERT INTO videos SET
title = '".mysql_escape_string($title)."',
urltitle = '".slug(mysql_escape_string($title))."',
description = '',
category = 'streams',
first_img = '".mysql_escape_string($imgurl)."',
o_url = 'http://watchnewfilms.com/'".mysql_escape_string($thisUrl)."',
type = 'stream',
embed = '".mysql_escape_string($embed)."',
last_updated = '".date("Y-m-d")."',
date_added = '".date("Y-m-d")."'";
任何人看到任何問題?
謝謝!
哇,感謝指出了這一點!還什麼mysql的真實逃生繩,只是MySQL的轉義字符串之間的區別? – 2010-10-31 19:47:07
@Belgin'mysql_real_escape_string()'將與一個實時數據庫連接一起工作,並且針對該連接的字符集返回轉義結果。 'mysql_escape_string()'是[棄用](http://www.php.net/manual/en/function.mysql-escape-string.php)。 – 2010-10-31 19:49:59