0

This is my code in update.php file :

<?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) 
?>

I am getting every variable here. I only need to update those values. But when I am trying to update I got an error like these. I do not understand what is going on... please, help me

<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>
StepUp
  • 36,391
  • 15
  • 88
  • 148
Dew Drop
  • 71
  • 1
  • 11

2 Answers2

0

No semicolon on line 27. $pid=$_REQUEST['var5'];

Juan Rangel
  • 1,763
  • 1
  • 18
  • 34
0
  $pid=$_REQUEST['var5']

to

 $pid=$_REQUEST['var5'];

Moreover, why have you written so many ifs? you can do it like

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

That's more readable.

Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78
  • thank you. when im trying to update e the code i got all the html page content alerting like an error. and in between those so many noices are showing like --- Notice: Undefined offset: 2 in C:\wamp\www\sceptre_internal\update.php on line 58 line 58 is $sql_upd is written – Dew Drop Dec 22 '15 at 07:42
  • what is this Notice: Undefined offset: 2 , Notice: Undefined offset: 3 ...etc? – Dew Drop Dec 22 '15 at 07:43
  • Updation failed
    ( ! ) Notice: Undefined offset: 2 in C:\wamp\www\sceptre_internal\update.php on line 58
    – Dew Drop Dec 22 '15 at 08:12