SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP and Mysql PHP Parse error

    Hi All

    Ive been struggling with one piece of code and hope someone can assist . I get the following error:
    [error] [client] PHP Parse error: parse error in D:\\Apache2.2\\htdocs\\property_appr_dml.php on line 50, referer: http://*.*.*/sitedetails_view.php

    line 50 in the file looks like this:
    sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = $data['site_name']", $o);

    Can anyone see any syntax problems?

    Thanks

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,401
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    Welcome to the SP forums.

    Would you mind posting some lines before and after line 50 as well? Sometimes the problem isn't in the line that causes the parser to give an error.

  3. #3
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Guido

    Thanks for your response. Some more code as requested:
    PHP Code:
        // hook: property_appr_before_insert
        
    if(function_exists('property_appr_before_insert')){
            
    $args=array();
            if(!
    property_appr_before_insert($datagetMemberInfo(), $args)){ return FALSE; }
        }

        
    $o=array('silentErrors' => true);
        
    sql('insert into `property_appr` set `site_name`=' . (($data['site_name'] != '') ? "'{$data['site_name']}'" 'NULL') . ', `owner_priniple`=' . (($data['owner_priniple'] != '') ? "'{$data['owner_priniple']}'" 'NULL') . ', `own_date`=' . (($data['own_date'] != '') ? "'{$data['own_date']}'" 'NULL') . ', `enviro_appr`=' . (($data['enviro_appr'] != '') ? "'{$data['enviro_appr']}'" 'NULL') . ', `enviro_na`=' . (($data['enviro_na'] != '') ? "'{$data['enviro_na']}'" 'NULL') . ', `enviro_date`=' . (($data['enviro_date'] != '') ? "'{$data['enviro_date']}'" 'NULL') . ', `la_type`=' . (($data['la_type'] != '') ? "'{$data['la_type']}'" 'NULL') . ', `la_appr`=' . (($data['la_appr'] != '') ? "'{$data['la_appr']}'" 'NULL') . ', `la_date`=' . (($data['la_date'] != '') ? "'{$data['la_date']}'" 'NULL') . ', `buildingplan`=' . (($data['buildingplan'] != '') ? "'{$data['buildingplan']}'" 'NULL') . ', `plan_date`=' . (($data['plan_date'] != '') ? "'{$data['plan_date']}'" 'NULL') . ', `lease_type`=' . (($data['lease_type'] != '') ? "'{$data['lease_type']}'" 'NULL') . ', `lease_appr`=' . (($data['lease_appr'] != '') ? "'{$data['lease_appr']}'" 'NULL') . ', `lease_date`=' . (($data['lease_date'] != '') ? "'{$data['lease_date']}'" 'NULL'), $o);
                  
    //********************************write to sitedetails***********************************
              //Update property site status
               
    if($data['owner_priniple'] == "1" AND $data['enviro_appr'] == "1" AND $data['la_appr'] == "1" AND $data['buildingplan'] == "1" AND $data['lease_appr'] == "1"){
                [
    B][COLOR="#FF0000"sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = $data['site_name']"$o);[/COLOR][/B]
              }
              elseif(
    $data['owner_priniple'] == "1" AND $data['enviro_appr'] == "1" AND $data['la_appr'] == "1" AND $data['buildingplan'] == "1" AND $data['lease_appr'] == ''){
                 
    sql("update `sitedetails` set `property_stat` = 'Pending Lease' where `id` = $data['site_name']"$o);
              }
              elseif(
    $data['owner_priniple'] == "1" AND $data['enviro_appr'] == "1" AND $data['la_appr'] == "1" AND $data['buildingplan'] == '' AND $data['lease_appr'] == ''){
                 
    sql("update `sitedetails` set `property_stat` = 'Pending Building Plan' where `id` = $data['site_name']"$o);
              }
              elseif(
    $data['owner_priniple'] == "1" AND $data['enviro_appr'] == "1" AND $data['la_appr'] == '' AND $data['buildingplan'] == '' AND $data['lease_appr'] == ''){
                 
    sql("update `sitedetails` set `property_stat` = 'Pending LA' where `id` = $data['site_name']"$o);
              }
              elseif(
    $data['owner_priniple'] == "1" AND $data['enviro_appr'] == '' AND $data['la_appr'] == '' AND $data['buildingplan'] == '' AND $data['lease_appr'] == ''){
                 
    sql("update `sitedetails` set `property_stat` = 'Pending EIA' where `id` = $data['site_name']"$o);
              }
              elseif(
    $data['owner_priniple'] == '' AND $data['enviro_appr'] == '' AND $data['la_appr'] == '' AND $data['buildingplan'] == '' AND $data['lease_appr'] == ''){
                 
    sql("update `sitedetails` set `property_stat` = 'Pending Owner' where `id` = $data['site_name']"$o);
              }
              else{
                 
    sql("update `sitedetails` set `property_stat` = 'Pending Approvals' where `id` = $data['site_name']"$o);
              }
              
    /***************************************************************************************/

            
    if($o['error']!=''){
            echo 
    $o['error'];
            echo 
    "<a href=\"property_appr_view.php?addNew_x=1\">{$Translation['< back']}</a>";
            exit;
        } 
    Last edited by guido2004; Apr 11, 2012 at 03:13. Reason: added php code tags

  4. #4
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My apologies, this is the correct error I am getting:

    PHP Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in D:\\Apache2.2\\htdocs\\property_appr_dml.php on line 50

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2008
    Location
    The Netherlands
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you do
    PHP Code:
    sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = ".$data['site_name'], $o); 
    Or
    PHP Code:
    sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = $data[site_name]"$o); 
    It should be fixed.

    This was your line:
    PHP Code:
    sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = $data['site_name']"$o); 
    Look at the end of your line, the colors are messed up. So you see there is something going wrong.

  6. #6
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RvanD85 View Post
    If you do
    PHP Code:
    sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = ".$data['site_name'], $o); 
    Or
    PHP Code:
    sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = $data[site_name]"$o); 
    It should be fixed.

    This was your line:
    PHP Code:
    sql("update `sitedetails` set `property_stat` = 'Ready to Build' where `id` = $data['site_name']"$o); 
    Look at the end of your line, the colors are messed up. So you see there is something going wrong.
    That did it ! Thank you RvanD85, much appreciated.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •