Click to See Complete Forum and Search --> : error help


jrthor2
11-20-2003, 02:36 PM
I am getting the following error:

b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/home/prgjr1/public_html/ra-new/stores/locator/class_webservice2.php</b> on line <b>205</b>

the class_webservice2.php file looks like this (line 205 is bolded, it is the very last line):

<?
require_once('dbconn.php');
include "config.php";
class mystorelookup
{
//this class is for generating a mapquest webservice for the website dynamically.

//$zip (zip code to look up store)

//$stores (array of stores we get back from mapquest)

//there are 2 functions you must call in this order:

//1. function fill_store_specs() is a function to get all the store information

//2. function show_stores() shows the resutls

var $zip; //zip code

var $stores; //array of stores

// passed in zip as string, stores as array, status as string

function find_stores_by_zip($zip) {
# reset our variables that we're using below....
$BAD_ADDRESS=0;
$AMBIGUITIES=0;
$NOFOUND=0;
$amb=array();
//$stores=array();
$miles = "100";
$maxshow = "10";

$locator_fixed = "closestprox=1&closestn=100&screen=find&link=results&country=US";

$myQuery="$MQIC_path?$locator_fixed&zip=$zip&miles=$miles&maxshow=$maxshow";

$fd= @fopen ( $myQuery, "r");

if (!$fd) {
$status="Error: Couldn't complete MAP request. Please try again later.";
return;
} else {
$tmp_result=fread($fd,50000);
fclose($fd);
//print "tmp_result =>$tmp_result<= <br>\n";
//exit;
eval( "?> $tmp_result" );
}
// if we got down here, we got something back from mapquest--now
// figure out what it was

if ($BAD_ADDRESS || $AMBIGUITIES || $NOFOUND || !@count($store_numbers) ) {
//$status="Error: No Rite Aid stores found for your query. Please
//try again.";
//return;
$this->$store[0] = "No results were found, try again later";
}
else
{
$this->$stores = fill_store_specs($store_numbers);
}
} //End function find_stores_by_zip

function fill_store_specs($store_numbers) {
// global $stores;
$temp_stores=array();
// $stores=array();
if (@count($store_numbers) ) {
$sql_stores="";
# build a string for our sql query "IN" clause
for(reset($store_numbers);$key=key($store_numbers);next($store_numbers)) {
$sql_stores.="$key,";
}
# if we've data, remove the last comma
if (strlen($sql_stores)) {
$sql_stores=substr($sql_stores,0,-1);
}
# do database lookup
$D=new mydb;
$sql="select
LOLCN_LOCN,
LOLCN_NAME,
LOLCN_ADDRESS,
LOLCN_CITY,
LOLCN_STATE,
LOLCN_ZIP,
LOLCN_ZIP4,
LOLCN_RX_AREA_CODE,
LOLCN_RX_EXCHANGE,
LOLCN_RX_EXTENSION,
LOLCN_FX_AREA_CODE,
LOLCN_FX_EXCHANGE,
LOLCN_FX_EXTENSION,
LOLCN_FE_AREA_CODE,
LOLCN_FE_EXCHANGE,
LOLCN_FE_EXTENSION,
LOLCN_FOOD_ATTR,
LOLCN_EXPRESS_ATTR,
LOLCN_PHOTO_ATTR,
LOLCN_TWENTYFOUR_ATTR,
LOLCN_DRIVETHRU_ATTR,
LOLCN_RITEREWARDS_ATTR,
LOLCN_GNC_ATTR,
LOLCN_WESTUNION_ATTR,
LOLCN_FE_HRS_MON,
LOLCN_FE_HRS_TUE,
LOLCN_FE_HRS_WED,
LOLCN_FE_HRS_THU,
LOLCN_FE_HRS_FRI,
LOLCN_FE_HRS_SAT,
LOLCN_FE_HRS_SUN,
LOLCN_RX_HRS_MON,
LOLCN_RX_HRS_TUE,
LOLCN_RX_HRS_WED,
LOLCN_RX_HRS_THU,
LOLCN_RX_HRS_FRI,
LOLCN_RX_HRS_SAT,
LOLCN_RX_HRS_SUN,
to_char(LOLCN_PROJ_OPEN_DTE, 'yyyy-mm-dd') MY_LOLCN_PROJ_OPEN_DTE,
to_char(LOLCN_RELOCN_DTE, 'yyyy-mm-dd') MY_LOLCN_RELOCN_DTE,
to_char(LOLCN_REOPEN_DTE, 'yyyy-mm-dd') MY_LOLCN_REOPEN_DTE,
PICTURE_MAKER,
PHOTO_RAMP,
STORE_STATUS,
LOLCN_DETAIL_DESC,
LOLCN_DIVISION
from sysadm.LOLCN_LOCATION
where LOLCN_LOCN in ($sql_stores)";

$D->my_sel($sql);
if ($D->ORA_ERR ) {
// need to handle errors
handle_ora_error($D,__FILE__,__LINE__);
}
for ($i=0; $i< $D->numrows; $i++) {
$key=sprintf ("%05d", $D->results[LOLCN_LOCN][$i]);
//STORE #
$fp1=$D->results[LOLCN_FE_AREA_CODE][$i];
$fp2=$D->results[LOLCN_FE_EXCHANGE][$i];
$fp3=$D->results[LOLCN_FE_EXTENSION][$i];
//PHARMACY #
$rp1=$D->results[LOLCN_RX_AREA_CODE][$i];
$rp2=$D->results[LOLCN_RX_EXCHANGE][$i];
$rp3=$D->results[LOLCN_RX_EXTENSION][$i];
//PHARMACY FAX #
$rpf1=$D->results[LOLCN_FX_AREA_CODE][$i];
$rpf2=$D->results[LOLCN_FX_EXCHANGE][$i];
$rpf3=$D->results[LOLCN_FX_EXTENSION][$i];

$fep= $fp1 > 0 ? "($fp1) $fp2-$fp3" : "";
$rxp= $rp1 > 0 ? "($rp1) $rp2-$rp3" : "";
$rxpf= $rpf1 > 0 ? "($rpf1) $rpf2-$rpf3" : "";
$temp_stores[$key] = array(
name=>$D->results[LOLCN_NAME][$i]
,addr1=>$D->results[LOLCN_ADDRESS][$i]
,city=>$D->results[LOLCN_CITY][$i]
,state=>$D->results[LOLCN_STATE][$i]
,zip=>$D->results[LOLCN_ZIP][$i]
,phone_fe=>$fep
,phone_ph=>$rxp
,phone_phf=>$rxpf
,distance=>$store_numbers[$key][distance]
,convenience_foods=>$D->results[LOLCN_FOOD_ATTR][$i]
,rite_express=>$D->results[LOLCN_EXPRESS_ATTR][$i]
,one_hour_photo=>$D->results[LOLCN_PHOTO_ATTR][$i]
,ra_24_hour=>$D->results[LOLCN_TWENTYFOUR_ATTR][$i]
,drive_thru_rx=>$D->results[LOLCN_DRIVETHRU_ATTR][$i]
,rite_rewards=>$D->results[LOLCN_RITEREWARDS_ATTR][$i]
,gnc=>$D->results[LOLCN_GNC_ATTR][$i]
,western_union=>$D->results[LOLCN_WESTUNION_ATTR][$i]
,hours_fe_mon=>$D->results[LOLCN_FE_HRS_MON][$i]
,hours_fe_tue=>$D->results[LOLCN_FE_HRS_TUE][$i]
,hours_fe_wed=>$D->results[LOLCN_FE_HRS_WED][$i]
,hours_fe_thu=>$D->results[LOLCN_FE_HRS_THU][$i]
,hours_fe_fri=>$D->results[LOLCN_FE_HRS_FRI][$i]
,hours_fe_sat=>$D->results[LOLCN_FE_HRS_SAT][$i]
,hours_fe_sun=>$D->results[LOLCN_FE_HRS_SUN][$i]
,hours_rx_mon=>$D->results[LOLCN_RX_HRS_MON][$i]
,hours_rx_tue=>$D->results[LOLCN_RX_HRS_TUE][$i]
,hours_rx_wed=>$D->results[LOLCN_RX_HRS_WED][$i]
,hours_rx_thu=>$D->results[LOLCN_RX_HRS_THU][$i]
,hours_rx_fri=>$D->results[LOLCN_RX_HRS_FRI][$i]
,hours_rx_sat=>$D->results[LOLCN_RX_HRS_SAT][$i]
,hours_rx_sun=>$D->results[LOLCN_RX_HRS_SUN][$i]
,store_date_open=>$D->results[MY_LOLCN_PROJ_OPEN_DTE][$i]
,store_date_relo=>$D->results[MY_LOLCN_RELOCN_DTE][$i]
,store_date_reopen=>$D->results[MY_LOLCN_REOPEN_DTE][$i]
,picture_maker=>$D->results[PICTURE_MAKER][$i]
,photo_ramp=>$D->results[PHOTO_RAMP][$i]
,store_status=>$D->results[STORE_STATUS][$i]
,detail_desc=>ereg_replace (' +', ' ', ucwords(strtolower( $D->results[LOLCN_DETAIL_DESC][$i])))
,division=>$D->results[LOLCN_DIVISION][$i]);
}
# now create a third hash that is in the same order as the one we
# came in with
if ($D->numrows) {
for(reset($store_numbers);$key=key($store_numbers);next($store_numbers)) {
$this->$stores[$key]=$temp_stores[$key];
}
}
}# end fill_store_specs
//return $stores;
} //end class mysurvey
?>

Can someone help here?

Thanks

Conor
11-20-2003, 02:42 PM
all i can tthink of is maybe you missed a bracket or semicolon somewhere and that caused the error to go screwy. Its happened to me before. The line where it said the error was was about 20 lines from where i missed a bracket

jrthor2
11-20-2003, 02:48 PM
any other ideas, I have triple checked the syntax, not missing anything.

Sexay_Hamster
11-20-2003, 04:02 PM
use:

include("");

not:

include "";

jrthor2
11-21-2003, 07:13 AM
I tried that, and still get the error. Here's my updated code:

<?
require_once('dbconn.php');
include ("config.php");
class mystorelookup
{
//this class is for generating a mapquest webservice for the website dynamically.
//$zip (zip code to look up store)
//$stores (array of stores we get back from mapquest)
//there are 2 functions you must call in this order:

//1. function fill_store_specs() is a function to get all the store information

//2. function show_stores() shows the resutls

var $zip; //zip code

var $stores; //array of stores

// passed in zip as string, stores as array, status as string

function find_stores_by_zip($zip) {
# reset our variables that we're using below....
$BAD_ADDRESS=0;
$AMBIGUITIES=0;
$NOFOUND=0;
$amb=array();
//$stores=array();
$miles = "100";
$maxshow = "10";

$locator_fixed = "closestprox=1&closestn=100&screen=find&link=results&country=US";

$myQuery="$MQIC_path?$locator_fixed&zip=$zip&miles=$miles&maxshow=$maxshow";

$fd= @fopen ( $myQuery, "r");

if (!$fd) {
$status="Error: Couldn't complete MAP request. Please try again later.";
return;
} else {
$tmp_result=fread($fd,50000);
fclose($fd);
//print "tmp_result =>$tmp_result<= <br>\n";
//exit;
eval( "?> $tmp_result" );
}
// if we got down here, we got something back from mapquest--now
// figure out what it was

if ($BAD_ADDRESS || $AMBIGUITIES || $NOFOUND || !@count($store_numbers) ) {
//$status="Error: No Rite Aid stores found for your query. Please
//try again.";
//return;
$this->$store[0] = "No results were found, try again later";
} else {
$this->$stores = fill_store_specs($store_numbers);
}
} //End function find_stores_by_zip

function fill_store_specs($store_numbers) {
// global $stores;
$temp_stores=array();
// $stores=array();
if (@count($store_numbers) ) {
$sql_stores="";
# build a string for our sql query "IN" clause
for(reset($store_numbers);$key=key($store_numbers);next($store_numbers)) {
$sql_stores.="$key,";
}
# if we've data, remove the last comma
if (strlen($sql_stores)) {
$sql_stores=substr($sql_stores,0,-1);
}
# do database lookup
$D=new mydb;
$sql="select
LOLCN_LOCN,
LOLCN_NAME,
LOLCN_ADDRESS,
LOLCN_CITY,
LOLCN_STATE,
LOLCN_ZIP,
LOLCN_ZIP4,
LOLCN_RX_AREA_CODE,
LOLCN_RX_EXCHANGE,
LOLCN_RX_EXTENSION,
LOLCN_FX_AREA_CODE,
LOLCN_FX_EXCHANGE,
LOLCN_FX_EXTENSION,
LOLCN_FE_AREA_CODE,
LOLCN_FE_EXCHANGE,
LOLCN_FE_EXTENSION,
LOLCN_FOOD_ATTR,
LOLCN_EXPRESS_ATTR,
LOLCN_PHOTO_ATTR,
LOLCN_TWENTYFOUR_ATTR,
LOLCN_DRIVETHRU_ATTR,
LOLCN_RITEREWARDS_ATTR,
LOLCN_GNC_ATTR,
LOLCN_WESTUNION_ATTR,
LOLCN_FE_HRS_MON,
LOLCN_FE_HRS_TUE,
LOLCN_FE_HRS_WED,
LOLCN_FE_HRS_THU,
LOLCN_FE_HRS_FRI,
LOLCN_FE_HRS_SAT,
LOLCN_FE_HRS_SUN,
LOLCN_RX_HRS_MON,
LOLCN_RX_HRS_TUE,
LOLCN_RX_HRS_WED,
LOLCN_RX_HRS_THU,
LOLCN_RX_HRS_FRI,
LOLCN_RX_HRS_SAT,
LOLCN_RX_HRS_SUN,
to_char(LOLCN_PROJ_OPEN_DTE, 'yyyy-mm-dd') MY_LOLCN_PROJ_OPEN_DTE,
to_char(LOLCN_RELOCN_DTE, 'yyyy-mm-dd') MY_LOLCN_RELOCN_DTE,
to_char(LOLCN_REOPEN_DTE, 'yyyy-mm-dd') MY_LOLCN_REOPEN_DTE,
PICTURE_MAKER,
PHOTO_RAMP,
STORE_STATUS,
LOLCN_DETAIL_DESC,
LOLCN_DIVISION
from sysadm.LOLCN_LOCATION
where LOLCN_LOCN in ($sql_stores)";

$D->my_sel($sql);
if ($D->ORA_ERR ) {
// need to handle errors
handle_ora_error($D,__FILE__,__LINE__);
}
for ($i=0; $i< $D->numrows; $i++) {
$key=sprintf ("%05d", $D->results[LOLCN_LOCN][$i]);
//STORE #
$fp1=$D->results[LOLCN_FE_AREA_CODE][$i];
$fp2=$D->results[LOLCN_FE_EXCHANGE][$i];
$fp3=$D->results[LOLCN_FE_EXTENSION][$i];
//PHARMACY #
$rp1=$D->results[LOLCN_RX_AREA_CODE][$i];
$rp2=$D->results[LOLCN_RX_EXCHANGE][$i];
$rp3=$D->results[LOLCN_RX_EXTENSION][$i];
//PHARMACY FAX #
$rpf1=$D->results[LOLCN_FX_AREA_CODE][$i];
$rpf2=$D->results[LOLCN_FX_EXCHANGE][$i];
$rpf3=$D->results[LOLCN_FX_EXTENSION][$i];

$fep= $fp1 > 0 ? "($fp1) $fp2-$fp3" : "";
$rxp= $rp1 > 0 ? "($rp1) $rp2-$rp3" : "";
$rxpf= $rpf1 > 0 ? "($rpf1) $rpf2-$rpf3" : "";
$temp_stores[$key] = array(
name=>$D->results[LOLCN_NAME][$i]
,addr1=>$D->results[LOLCN_ADDRESS][$i]
,city=>$D->results[LOLCN_CITY][$i]
,state=>$D->results[LOLCN_STATE][$i]
,zip=>$D->results[LOLCN_ZIP][$i]
,phone_fe=>$fep
,phone_ph=>$rxp
,phone_phf=>$rxpf
,distance=>$store_numbers[$key][distance]
,convenience_foods=>$D->results[LOLCN_FOOD_ATTR][$i]
,rite_express=>$D->results[LOLCN_EXPRESS_ATTR][$i]
,one_hour_photo=>$D->results[LOLCN_PHOTO_ATTR][$i]
,ra_24_hour=>$D->results[LOLCN_TWENTYFOUR_ATTR][$i]
,drive_thru_rx=>$D->results[LOLCN_DRIVETHRU_ATTR][$i]
,rite_rewards=>$D->results[LOLCN_RITEREWARDS_ATTR][$i]
,gnc=>$D->results[LOLCN_GNC_ATTR][$i]
,western_union=>$D->results[LOLCN_WESTUNION_ATTR][$i]
,hours_fe_mon=>$D->results[LOLCN_FE_HRS_MON][$i]
,hours_fe_tue=>$D->results[LOLCN_FE_HRS_TUE][$i]
,hours_fe_wed=>$D->results[LOLCN_FE_HRS_WED][$i]
,hours_fe_thu=>$D->results[LOLCN_FE_HRS_THU][$i]
,hours_fe_fri=>$D->results[LOLCN_FE_HRS_FRI][$i]
,hours_fe_sat=>$D->results[LOLCN_FE_HRS_SAT][$i]
,hours_fe_sun=>$D->results[LOLCN_FE_HRS_SUN][$i]
,hours_rx_mon=>$D->results[LOLCN_RX_HRS_MON][$i]
,hours_rx_tue=>$D->results[LOLCN_RX_HRS_TUE][$i]
,hours_rx_wed=>$D->results[LOLCN_RX_HRS_WED][$i]
,hours_rx_thu=>$D->results[LOLCN_RX_HRS_THU][$i]
,hours_rx_fri=>$D->results[LOLCN_RX_HRS_FRI][$i]
,hours_rx_sat=>$D->results[LOLCN_RX_HRS_SAT][$i]
,hours_rx_sun=>$D->results[LOLCN_RX_HRS_SUN][$i]
,store_date_open=>$D->results[MY_LOLCN_PROJ_OPEN_DTE][$i]
,store_date_relo=>$D->results[MY_LOLCN_RELOCN_DTE][$i]
,store_date_reopen=>$D->results[MY_LOLCN_REOPEN_DTE][$i]
,picture_maker=>$D->results[PICTURE_MAKER][$i]
,photo_ramp=>$D->results[PHOTO_RAMP][$i]
,store_status=>$D->results[STORE_STATUS][$i]
,detail_desc=>ereg_replace (' +', ' ', ucwords(strtolower( $D->results[LOLCN_DETAIL_DESC][$i])))
,division=>$D->results[LOLCN_DIVISION][$i]);
}
# now create a third hash that is in the same order as the one we
# came in with
if ($D->numrows) {
for(reset($store_numbers);$key=key($store_numbers);next($store_numbers)) {
$this->$stores[$key]=$temp_stores[$key];
}
}
} // end fill_store_specs
} //end class mystorelookup
?>

DaiWelsh
11-21-2003, 07:29 AM
I suggest you quadruple check your syntax

Number of { = 14
Number of } = 13

:eek: I cant see your indentation so I dont know exactly which one you lost but there needs to be another close at or near the end of the file.

jrthor2
11-21-2003, 07:34 AM
I got it fixed, there was a missing } at the end. Thanks, sometimes it helps to have a 2nd set of eyes.