我試圖創建一個mysql查詢(使用Dreamweaver的記錄集功能,涉及2個表加入,並使用傳遞的變量過濾它_$GET
's從(??)
我不知道我在做什麼錯誤,因爲我創建了這個DW記錄集----我的概念是什麼?過時了?
我使用的位置表與主鍵location_id
等於classschedules表與外鍵location_id
,然後過濾classschedules表爲equ一個傳入的變量(在這種情況下,int 3傳遞)。
這裏的代碼片段:
$colname_location_classschedule = "-1";
if (isset($_GET['season_id'])) {
$colname_location_classschedule = $_GET['season_id'];
}
mysql_select_db($database_tconn, $tconn);
$query_location_classschedule = sprintf("SELECT * FROM classschedules, locations
WHERE classschedules.location_id = locations.location_id AND
classschedules.season_id = %s",
GetSQLValueString($colname_location_classschedule, "int"));
$location_classschedule = mysql_query($query_location_classschedule, $tconn) or
die(mysql_error());
$row_location_classschedule = mysql_fetch_assoc($location_classschedule);
$totalRows_location_classschedule = mysql_num_rows($location_classschedule);
所以這是傳遞變量的頁面通過這樣的:
(http)//mysite.com/classschd/test.php?season_id=3
我希望我所有的位置我安排的課程列表爲特定季節(季節3)。
相反,這是我在瀏覽器中得到的錯誤: 「您的SQL語法有錯誤;請查看與您的MySQL服務器版本相對應的手冊,以便在第1行附近使用正確的語法「-----我不明白錯誤信息,我已經找到了答案,我在這裏問。
對Dreamweaver來說,任何幫助都會對我有所幫助。我使用Dreamweaver CS6,PHP 5.4,MySQL 5.5。 - 剛剛在2013年8月上傳了大部分節目。