Switch语句始终为默认值

时间:2013-09-30 01:26:31

标签: php html

我在wampserver的脚本中遇到问题。它运行良好。但在我的托管中它不显示 该页面名为classed.php?cat = [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';

?>

请帮助thanx :)

1 个答案:

答案 0 :(得分:0)

最可能的原因是您在调用此函数时没有打开的数据库连接。在这种情况下,mysql_real_escape_string只返回false。