Re: 4 hours staring - can't see clear.

From: Date: Thu, 12 Jun 2003 07:53:30 +0000
Subject: Re: 4 hours staring - can't see clear.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-151206@lists.php.net to get a copy of this message
You can't embed function calls in strings like this $sString = "{addslashes($blah)},{addslashes($blah)}"; you have to go $sString = addslashes($blah) . ',' . addslashes($blah); Lang John Taylor-Johnston wrote: > Lars, > > Thanks. I am getting this error however: > > Parse error: parse error, expecting T_STRING' or > T_VARIABLE' or > `T_NUM_STRING' in > > It does not like addslashes() because of the {}? What is a sensible work > around? Or do I even need addslashes?? > > if ($found) > { > $sql = "INSERT INTO $dbtable > (RNum,YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,SR,PL,PR,JR,VNum,INum,DT,PG,LG,SF,OL,KW,AUS,GEO,AN,RB,CO,RR) > VALUES > ('{addslashes($record['RNum'])}','{addslashes($record['YR'])}','{addslashes($record['AU'])}','{addslashes($record['ST'])}','{addslashes($record['SD'])}','{addslashes($record['SC'])}','{addslashes($record['BT'])}','{addslashes($record['BD'])}','{addslashes($record['BC'])}','{addslashes($record['AT'])}','{addslashes($record['AD'])}','{addslashes($record['AC'])}','{addslashes($record['SR'])}','{addslashes($record['PL'])}','{addslashes($record['PR'])}','{addslashes($record['JR'])}','{addslashes($record['VNum'])}','{addslashes($record['INum'])}','{addslashes($record['DT'])}','{addslashes($record['PG'])}','{addslashes($record['LG'])}','{addslashes($record['SF'])}','{addslashes($record['OL'])}','{addslashes($record['KW'])}','{addslashes($record['AUS'])}','{addslashes($record['GEO'])}','{addslashes($record['AN'])}','{addslashes($record['RB'])}','{addslashes($record['CO'])}','{addslashes($record['RR'])}')"; > echo "$sql<hr>\n"; > } > > ---------snip------

« previous php.general (#151206) next »