PDA

View Full Version : Parse Error in Code



Diversions
03-26-2008, 02:32 PM
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



$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 =================================================
==========================================================================


$special_price = tep_get_products_special_price($prid);
if ($special_price) {
$products_price = $special_price;
}

and

==========================================================================
= FIND ===================================================================
==========================================================================


$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 =================================================
==========================================================================


$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.



$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

jc_gmk
03-26-2008, 03:47 PM
at a glance you are missing a "{" just before $this->$key=$kv['value'];



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