2015-12-22 12 views
0

這是我在update.php文件代碼:錯誤得到儘可能解析錯誤:語法錯誤,意想不到的T_VARIABLE

<?php 

if(isset($_REQUEST['arr'])) 
{ 
    if(isset($_REQUEST['var1'])) 
    { 
     if(isset($_REQUEST['var2'])) 
     { 
      if(isset($_REQUEST['var3'])) 
      { 
       if(isset($_REQUEST['var4'])) 
       { 
        if(isset($_REQUEST['var5'])) 
        { 
        //echo $pid=$_REQUEST['var5'];exit; 

         $all_data=array(); 
         $all_data=array_chunk($_REQUEST['arr'], 19); 


         foreach($all_data as $values) 
         { 
        //echo "inside loop"; 
         $month=$_REQUEST['var1']; 
         $week=$_REQUEST['var2']; 
         $gtot_stu=$_REQUEST['var3']; 
         $gtot_otu=$_REQUEST['var4']; 
         $pid=$_REQUEST['var5'] 


        //$sql_upd="update timesheet_entry set s_st=$values[0],s_ot=$values[1],m_st=$values[2],m_ot=$values[3],t_st=$values[4],t_ot=$values[5],w_st=$values[6],w_ot=$values[7],th_st=$values[8],th_ot=$values[9],f_st=$values[10],f_ot=$values[11],sa_st=$values[12],sa_ot=$values[13],job_code=$values[14],job_name='$values[15]',st_tot=$values[16],ot_tot=$values[17],pm='$values[18]',gtot_st=$gtot_stu,gtot_ot=$gtot_otu where id='143'"; 

// $sql_upd="update timesheet_entry set s_st=$values[0] where ='$pid'";   


    $sql_upd="update timesheet_entry set s_st=$values[0] where id='143'"; 



        if(mysql_query($sql_upd)) 
        { 

         echo "Updated..!"; 
        } 
        else 
        { 
         echo "Updation failed"; 
        } 

       } //foreach 
      } // var 5 
      }//var4 
     }//var3 

     } //var2 
    }//var1 
} //if (arr) 
?> 

我在這裏得到的每一個變量。我只需要更新這些值。但是當我試圖更新時,我得到了這樣的錯誤。我不明白這是怎麼回事......請幫我

<br /> 
<font size='1'><table class='xdebug-error xe-parse-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'> 
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>(!)</span> Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\sceptre_internal\update.php on line <i>63</i></th></tr> 
</table></font> 
+0

必有行no..write那以及 –

+2

我想你已經錯過了結束行$ PID = $分號後_ REQUEST [「VAR5」] – ranakrunal9

+0

@ ranakrunal9你應該寫在答案:) –

回答

0

上線別無分號27 $pid=$_REQUEST['var5'];

0
$pid=$_REQUEST['var5'] 

$pid=$_REQUEST['var5']; 

而且,你爲什麼寫那麼多ifs?你可以像

if(isset(PARAMS1) && isset(PARAMS2) && isset(PARAMS3)) 

這更可讀。

+0

謝謝。當即時通訊嘗試更新代碼時,我得到了所有的HTML頁面內容警告,如錯誤。並且在那些如此之多的聲音之間顯示出如下---注意:未定義偏移量:2在C:\ wamp \ www \ sceptre_internal \ update.php上線第58行是$ sql_upd寫入 –

+0

錯誤是什麼? –

+0

這是什麼意思:未定義偏移量:2,注意:未定義偏移量:3 ...等等? –

相關問題