2012-12-28 98 views
-1

我有一個網站至少一年未觸及。上線\主機\ XXXXXX 22解析錯誤:語法錯誤,意外T_VARIABLE

在該行的代碼看起來是這樣的:所有的突然我收到此錯誤信息: 解析錯誤:語法錯誤,在d意外T_VARIABLE

$theValue = ($theValue != "") ? doubl$query_rs_get_categories = "SELECT * FROM talent_master_categories ORDER BY master_category_priority ASC"; 

以下是該頁面的完整代碼段:

<?php 
if (!function_exists("GetSQLValueString")) { 
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{ 
    if (PHP_VERSION < 6) { 
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; 
    } 

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); 

    switch ($theType) { 
    case "text": 
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
     break;  
    case "long": 
    case "int": 
     $theValue = ($theValue != "") ? intval($theValue) : "NULL"; 
     break; 
    case "double": 
     $theValue = ($theValue != "") ? doubl$query_rs_get_categories = "SELECT * FROM talent_master_categories ORDER BY master_category_priority ASC"; 
$rs_get_categories = mysql_query($query_rs_get_categories, $conn_talent) or die(mysql_error()); 
$row_rs_get_categories = mysql_fetch_assoc($rs_get_categories); 
$totalRows_rs_get_categories = mysql_num_rows($rs_get_categories); 
?> 

任何想法是怎麼回事?我不知道爲什麼它會突然停止工作。 感謝您的任何意見

+1

使用語法highlighing的編輯器。很明顯。 – mario

+1

什麼是'?雙重$ query_rs_get_categories ='應該是? – CodeZombie

+1

至少有3個錯誤,我看到 –

回答

1

如果您使用的三元操作,那麼你必須使用:此行

$theValue = ($theValue != "") ? ($query_rs_get_categories = "SELECT * 
FROM talent_master_categories ORDER BY master_category_priority ASC") : ""; 

內,你$query_rs_get_categories之前寫doubl刪除doubl

+1

爲什麼downvote?哪裏不對? –

+0

爲什麼可憐的upvotes?這如何解決任何問題?很明顯,那裏有更多的刪除代碼。像這樣將其無匹配地連接在一起(三元建議現在將代碼連接到缺少的開關塊末端之外)將不會導致運行結果。 – mario

1

你對一個錯字行:$theValue = ($theValue != "") ? doubl$query_rs_get_categories = "SELECT * FROM talent_master_categories ORDER BY master_category_priority ASC";

具體而言,doubl之前$query_rs_get_categories

2

還有1行需要處理,我沒有理會修復它,因爲我不知道你想達到什麼樣的(三元,調用另一個函數等):

$theValue = ($theValue != "") ? doubl$query_rs_get_categories = "SELECT * FROM talent_master_categories ORDER BY master_category_priority ASC"; 

可能:

$theValue = ($theValue != "") ? $query_rs_get_categories : "SELECT * FROM talent_master_categories ORDER BY master_category_priority ASC"; 

不談,你失蹤switchfunction,並且if聲明右括號

if (!function_exists("GetSQLValueString")) { 
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { 
     if (PHP_VERSION < 6) { 
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; 
     } 

     $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); 

     switch ($theType) { 
      case "text": 
       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
       break;  
      case "long": 
      case "int": 
       $theValue = ($theValue != "") ? intval($theValue) : "NULL"; 
       break; 
      case "double": 
       $theValue = ($theValue != "") ? doubl$query_rs_get_categories = "SELECT * FROM talent_master_categories ORDER BY master_category_priority ASC"; 
     } 
     $rs_get_categories = mysql_query($query_rs_get_categories, $conn_talent) or die(mysql_error()); 
     $row_rs_get_categories = mysql_fetch_assoc($rs_get_categories); 
     $totalRows_rs_get_categories = mysql_num_rows($rs_get_categories); 
    } 
} 
1

我的觀點是,你的文件在某種程度上被損壞了,應該圍繞該行寫着:

case "double": 
     $theValue = ($theValue != "") ? double($theValue) : "NULL"; 
} 
$query_rs_get_categories = "SELECT * FROM talent_master_categories ORDER BY master_category_priority ASC"; 
$rs_get_categories = mysql_query($query_rs_get_categories, $conn_talent) or die(mysql_error()); 

我認爲這是破壞的原因是$ query_rs_get_categories沒有在功能別處定義並沒有整個事情會失敗在函數中定義。

相關問題