0
我有下面的代碼,這對我不起作用。我曾經有$ HTTP_GET_VARS而不是$ _GET,但後來更新到PHP 5,現在事情已經破裂。有什麼想法,我在做什麼錯在這裏?
<?php
$_GET['SubCat'];
$_GET['Location'];
$db = mysql_connect("localhost", "xxxx", "xxxx");
mysql_select_db("outdoors",$db);
if ($Location) {
$result = mysql_query("SELECT ID, Longitude, URL, SiteName, Description FROM hunting WHERE SubCategory = '$SubCat' AND Location = '$Location' AND Status <> 'HIDDEN' ORDER BY SiteName",$db);
} else {
$result = mysql_query("SELECT ID, Longitude, URL, SiteName, Description FROM hunting WHERE SubCategory = '$SubCat' AND Status <> 'HIDDEN' ORDER BY SiteName",$db);
<More unrelated stuff after this>
變量將通過這樣的鏈接進行傳遞:
hunting.php?SubCat=Hunting+Locations
您沒有存儲來自get的值,並且$ location的位置我沒有找到該變量? – Vijay 2011-04-28 07:17:37
位置保留給未來的功能。 – GoNorthWest 2011-04-28 07:20:01
不是$ _GET存儲在變量中的值,我將它傳遞給像'SubCat'?我認爲這是它的工作方式。 – GoNorthWest 2011-04-28 07:20:36