2013-09-30 58 views
-4

我在wampserver中的腳本中遇到問題。它運行良好。但是,在我的託管不顯示 被命名爲classed.php?貓頁面= [category_Name_Example]開關狀態始終默認

<?php header("Content-type: text/html; charset=utf-8"); 
?> 
<?php include_once("analyticstracking.php") ?> 

<?php 
include 'includis/html_codes.php'; 
include 'includis/config.php'; 
$catID= mysql_real_escape_string($_GET['cat']); 

switch ($catID) 
{ 


    case 'javascript' : 
    $catName = "javascript"; 
    $PageTitle = "Javascript "; 
    $img = "img/javascript.png"; 
    break; 

    case 'htmlandcss' : 
    $catName = "htmlandcss"; 
    $PageTitle = "html "; 
    $img = "img/html2.png"; 
    break; 

    default:header('location: /404'); 
} 
if (!isset($catID)){ 
header ('Location 404.php'); 
} 
if (empty($catID)){header ('Location 404.php');} 

include 'includis/db.php'; 

?> 

請幫助感謝名單:)

+1

你爲什麼使用'mysql_real_escape_string'?另外*「它不運行」*是**不是**有效的問題描述。 – Phil

+0

另一件事;你應該在發送一個* Location *標題後總是**'exit' – Phil

+0

如果你在交換機之前使用'var_dump($ catID)',你會得到什麼? – andrewsi

回答

0

最可能的原因是,你沒有一個在調用此函數時打開數據庫連接。在這種情況下,mysql_real_escape_string只是返回false。

+0

謝謝你真的我沒有包括數據庫連接在我現在包括的文件的頂部,它有運行良好謝謝:) – Mehdi