Results 1 to 2 of 2

Thread: Parse Error in Code

  1. #1
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default Parse Error in Code

    I am new to trying my hand at php code and have run into a parse error that I cannot figure out and hope someone in here can guide me.

    I have set up an e-comm site and it is working fine. I am trying to make adjustments to a particular page and changing the following two codes to that below them

    Code:
              $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'");
              if (tep_db_num_rows ($specials_query)) {
                $specials = tep_db_fetch_array($specials_query);
                $products_price = $specials['specials_new_products_price'];
              }
    ==========================================================================
    = REPLACE THE ABOVE WITH =================================================
    ==========================================================================
    Code:
              $special_price = tep_get_products_special_price($prid);
              if ($special_price) {
                $products_price = $special_price;
              }
    and

    ==========================================================================
    = FIND ===================================================================
    ==========================================================================
    Code:
              $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'");
              if (tep_db_num_rows($specials_query)) {
                $specials = tep_db_fetch_array($specials_query);
                $products_price = $specials['specials_new_products_price'];
              }
    ==========================================================================
    = REPLACE THE ABOVE WITH =================================================
    ==========================================================================
    Code:
              $special_price = tep_get_products_special_price($prid);
              if ($special_price) {
                $products_price = $special_price;
              }
    When I replace the codes above I get the following Parse Error:

    "Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /usr/www/virtual/mhacorpd/www.domainwebsite.com/catalog/includes/classes/shopping_cart.php on line 424"

    When I return the php document to original there is no problem.
    This is what line 424 and the few before and after looks like and for the life of me I have no idea what is wrong but I do know that the error rests in the above codes - somewhere.

    Code:
    $key=$kv['key'];
    if (gettype($this->$key)!="user function")
    $this->$key=$kv['value'];
    }
    } //>>>>>LINE 424
    
    }
    ?>
    If there is anyone who can give me a hint at where my code is incorrect it would be greatly appreciated.

    Thank you
    D
    Last edited by thetestingsite; 03-26-2008 at 02:42 PM. Reason: added code tags

  2. #2
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default

    at a glance you are missing a "{" just before $this->$key=$kv['value'];

    PHP Code:
    if (gettype($this->$key)!="user function")
    {
    $this->$key=$kv['value'];


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
  •