Re: [PHP] FW: parse error

2011-10-17 Thread Stuart Dallas
PLEASE INCLUDE THE LIST WHEN REPLYING!

On 17 Oct 2011, at 18:21, David Savage wrote:

> No... I log into a linux box, and use the vi editor (actually I use 'view', 
> which is vi but without the color highlighting which is somewhat hard to see 
> on some colors, such as blue on a black screen). 

As I said, get one. There are loads of free editors for all operating systems 
that do syntax highlighting for PHP. Get one, load the file up in that and have 
a look.

-Stuart


> From: Stuart Dallas [mailto:stu...@3ft9.com]
> Sent: Thu 10/13/2011 1:43 PM
> To: David Savage
> Cc: PHP General
> Subject: Re: [PHP] FW: parse error
> 
> Please include the list when replying.
> 
> On 13 Oct 2011, at 19:44, David Savage wrote:
> 
>> ok thanks for the quick reply.  Still trying to figure out the line that is 
>> causing the problem above that line 1050I'm a novice at php, and 
>> currently use it just for console programming, though I want to eventually 
>> learn how to place html code in it, and make it simpler to run this program 
>> in a web browser, instead of by the command line.
> 
> Are you using an editor that does syntax highlighting? If not, find one and 
> load up the file. If you have an unterminated string or similar error, the 
> highlighting should tell you where that problem is.
> 
> -Stuart
> 
>> From: Stuart Dallas [mailto:stu...@3ft9.com]
>> Sent: Thu 10/13/2011 12:04 PM
>> To: David Savage
>> Cc: php-general@lists.php.net
>> Subject: Re: [PHP] FW: parse error
>> 
>> On 13 Oct 2011, at 18:06, David Savage wrote:
>> 
>> > I'm sorryI need help with php v. 4.3.9 (cgi).  I don't know where else 
>> > to turn.  I've looked on the php.net web site for details on this 
>> > particular error, but am unable to find any.
>> >
>> > this is the version I use.
>> > php -v
>> > PHP 4.3.9 (cgi) (built: Jun 26 2006 09:46:03)
>> > Copyright (c) 1997-2004 The PHP Group
>> > Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
>> >
>> > I run the following command, and getting the following compile error on a 
>> > linux environment:
>> > php -l voip_cdrs.php
>> > PHP Parse error:  parse error, unexpected T_STRING in 
>> > /usr/local/cytrex/voip_cdrs.php on line 1050
>> > Errors parsing voip_cdrs.php
>> >
>> > here is a portion of the code that includes the line number mentioned:
>> > if   ($destlen==11) {
>> >$start_from_which_offset=1;
>> > }
>> > if   ($destlen==10) {
>> >$start_from_which_offset=0;
>> > }
>> > $termnum10=substr($dest, $start_from_which_offset,10);
>> > $alias_sql_stmt="SELECT ani FROM ldrates WHERE 
>> > ani='$termnum10'";// <-this is line 1050
>> > print "$alias_sql_stmt\n";
>> > $alias_result = $db->sql_query($alias_sql_stmt);
>> > if  ($alias_result==TRUE) {
>> >if($db->sql_numrows($alias_result) > 0) {
>> >print "Found alias...\n";
>> >continue;
>> >}
>> > } else {
>> >die("problem with sql: $alias_sql_stmt");
>> > }
>> >
>> > Could you please tell me what's wrong with the line 1050 ?   I've been 
>> > pulling my hair out (figuratively speaking) trying to understand why the 
>> > compiler sees this line as a problem.  Thanks for whatever help you can 
>> > give.
>> 
>> There is nothing wrong with the code you've posted...
>> 
>> stuart@willow:~$ php -l test.php
>> No syntax errors detected in test.php
>> 
>> Which means the error is likely above that in the file.
>> 
>> -Stuart
>> 
>> --
>> Stuart Dallas
>> 3ft9 Ltd
>> http://3ft9.com/
>> 

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/



Re: [PHP] FW: parse error

2011-10-13 Thread Stuart Dallas
Please include the list when replying.

On 13 Oct 2011, at 19:44, David Savage wrote:

> ok thanks for the quick reply.  Still trying to figure out the line that is 
> causing the problem above that line 1050I'm a novice at php, and 
> currently use it just for console programming, though I want to eventually 
> learn how to place html code in it, and make it simpler to run this program 
> in a web browser, instead of by the command line.

Are you using an editor that does syntax highlighting? If not, find one and 
load up the file. If you have an unterminated string or similar error, the 
highlighting should tell you where that problem is.

-Stuart

> From: Stuart Dallas [mailto:stu...@3ft9.com]
> Sent: Thu 10/13/2011 12:04 PM
> To: David Savage
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] FW: parse error
> 
> On 13 Oct 2011, at 18:06, David Savage wrote:
> 
> > I'm sorryI need help with php v. 4.3.9 (cgi).  I don't know where else 
> > to turn.  I've looked on the php.net web site for details on this 
> > particular error, but am unable to find any.
> >
> > this is the version I use.
> > php -v
> > PHP 4.3.9 (cgi) (built: Jun 26 2006 09:46:03)
> > Copyright (c) 1997-2004 The PHP Group
> > Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
> >
> > I run the following command, and getting the following compile error on a 
> > linux environment:
> > php -l voip_cdrs.php
> > PHP Parse error:  parse error, unexpected T_STRING in 
> > /usr/local/cytrex/voip_cdrs.php on line 1050
> > Errors parsing voip_cdrs.php
> >
> > here is a portion of the code that includes the line number mentioned:
> > if   ($destlen==11) {
> >$start_from_which_offset=1;
> > }
> > if   ($destlen==10) {
> >$start_from_which_offset=0;
> > }
> > $termnum10=substr($dest, $start_from_which_offset,10);
> > $alias_sql_stmt="SELECT ani FROM ldrates WHERE 
> > ani='$termnum10'";// <-this is line 1050
> > print "$alias_sql_stmt\n";
> > $alias_result = $db->sql_query($alias_sql_stmt);
> > if  ($alias_result==TRUE) {
> >if($db->sql_numrows($alias_result) > 0) {
> >print "Found alias...\n";
> >continue;
> >}
> > } else {
> >die("problem with sql: $alias_sql_stmt");
> > }
> >
> > Could you please tell me what's wrong with the line 1050 ?   I've been 
> > pulling my hair out (figuratively speaking) trying to understand why the 
> > compiler sees this line as a problem.  Thanks for whatever help you can 
> > give.
> 
> There is nothing wrong with the code you've posted...
> 
> stuart@willow:~$ php -l test.php
> No syntax errors detected in test.php
> 
> Which means the error is likely above that in the file.
> 
> -Stuart
> 
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
> 



RE: [PHP] FW: parse error

2011-10-13 Thread Ken Robinson

At 02:06 PM 10/13/2011, Steve Staples wrote :

[snip]



It's more likely an unterminated quoted string.
It looks like PHP is giving up after finding unrecognizable stuff 
after either the first double or single quote on that line. If 
you're using an editor that doesn't do syntax high lighting, get one.


Ken

I would suggest that you figure out what is the value of the 
variable your passing into your query  is it possible that the 
value is getting a ' character, in which case it would be crapping 
out the line...


That would only occur when the script is actually executed. It's not 
getting that far yet, since it's dying on a syntax error during the parse.



For now, try adding [addslashes]:
 $termnum10=addslashes(substr($dest, $start_from_which_offset,10));
 $alias_sql_stmt="SELECT ani FROM ldrates WHERE 
ani='$termnum10'";// <-this is line 1050


No, mysql_real_escape_string 
(http://php.net/mysql_real_escape_string) should be used, not 
addslashes, although there are some people who have suggested that 
even that function is not enough and that only using stored 
procedures is good enough.


Ken 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] FW: parse error

2011-10-13 Thread Steve Staples


-Original Message-
From: Ken Robinson [mailto:kenrb...@rbnsn.com] 
Sent: Thursday, October 13, 2011 1:33 PM
To: php-general@lists.php.net
Subject: Re: [PHP] FW: parse error

At 01:26 PM 10/13/2011, Robert Williams wrote:
>On 10/13/11 10:06, "David Savage"  wrote:
>
>
> >php -l voip_cdrs.php
> >PHP Parse error:  parse error, unexpected T_STRING in 
> >/usr/local/cytrex/voip_cdrs.php on line 1050 Errors parsing 
> >voip_cdrs.php
> >
> > $alias_sql_stmt="SELECT ani FROM ldrates WHERE
> >ani='$termnum10'";// <-this is line 1050
> >
> >Could you please tell me what's wrong with the line 1050 ?   I've been
> >pulling my hair out (figuratively speaking) trying to understand why 
> >the compiler sees this line as a problem.  Thanks for whatever help 
> >you can give.
>
>My suspicion is that there's is an unmatched curly brace earlier in the 
>file. With this type of error, you'll generally get a report of a bad 
>line further down the file--sometimes way down--because the parser 
>can't recognize until it hits the later point that something is wrong. 
>Try double-checking that the {Š} blocks prior to line 1050 properly 
>balance, and you'll probably find there's an extra one, or that one is 
>missing, etc.

It's more likely an unterminated quoted string. 
It looks like PHP is giving up after finding unrecognizable stuff after either 
the first double or single quote on that line. If you're using an editor that 
doesn't do syntax high lighting, get one.

Ken 


I would suggest that you figure out what is the value of the variable your 
passing into your query  is it possible that the value is getting a ' 
character, in which case it would be crapping out the line...

For now, try adding [addslashes]:
 $termnum10=addslashes(substr($dest, $start_from_which_offset,10));
 $alias_sql_stmt="SELECT ani FROM ldrates WHERE ani='$termnum10'";// 
<-this is line 1050

Steve.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] FW: parse error

2011-10-13 Thread Ken Robinson

At 01:26 PM 10/13/2011, Robert Williams wrote:

On 10/13/11 10:06, "David Savage"  wrote:


>php -l voip_cdrs.php
>PHP Parse error:  parse error, unexpected T_STRING in
>/usr/local/cytrex/voip_cdrs.php on line 1050
>Errors parsing voip_cdrs.php
>
> $alias_sql_stmt="SELECT ani FROM ldrates WHERE
>ani='$termnum10'";// <-this is line 1050
>
>Could you please tell me what's wrong with the line 1050 ?   I've been
>pulling my hair out (figuratively speaking) trying to understand why the
>compiler sees this line as a problem.  Thanks for whatever help you can
>give.

My suspicion is that there's is an unmatched curly brace earlier in the
file. With this type of error, you'll generally get a report of a bad line
further down the file--sometimes way down--because the parser can't
recognize until it hits the later point that something is wrong. Try
double-checking that the {Š} blocks prior to line 1050 properly balance,
and you'll probably find there's an extra one, or that one is missing, etc.


It's more likely an unterminated quoted string. 
It looks like PHP is giving up after finding 
unrecognizable stuff after either the first 
double or single quote on that line. If you're 
using an editor that doesn't do syntax high lighting, get one.


Ken 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] FW: parse error

2011-10-13 Thread Robert Williams
On 10/13/11 10:06, "David Savage"  wrote:


>php -l voip_cdrs.php
>PHP Parse error:  parse error, unexpected T_STRING in
>/usr/local/cytrex/voip_cdrs.php on line 1050
>Errors parsing voip_cdrs.php
>
> $alias_sql_stmt="SELECT ani FROM ldrates WHERE
>ani='$termnum10'";// <-this is line 1050
>
>Could you please tell me what's wrong with the line 1050 ?   I've been
>pulling my hair out (figuratively speaking) trying to understand why the
>compiler sees this line as a problem.  Thanks for whatever help you can
>give.

My suspicion is that there's is an unmatched curly brace earlier in the
file. With this type of error, you'll generally get a report of a bad line
further down the file--sometimes way down--because the parser can't
recognize until it hits the later point that something is wrong. Try
double-checking that the {Š} blocks prior to line 1050 properly balance,
and you'll probably find there's an extra one, or that one is missing, etc.

If nothing else, just start stripping code from the file until you find
the line that's actually at fault. If you do this in a binary search
fashion, it won't take more than a few minutes.


Regards,
Bob
--
Robert E. Williams, Jr.
Associate Vice President of Software Development
Newtek Businesss Services, Inc. -- The Small Business Authority
https://www.newtekreferrals.com/rewjr
http://www.thesba.com/







Notice: This communication, including attachments, may contain information that 
is confidential. It constitutes non-public information intended to be conveyed 
only to the designated recipient(s). If the reader or recipient of this 
communication is not the intended recipient, an employee or agent of the 
intended recipient who is responsible for delivering it to the intended 
recipient, or if you believe that you have received this communication in 
error, please notify the sender immediately by return e-mail and promptly 
delete this e-mail, including attachments without reading or saving them in any 
manner. The unauthorized use, dissemination, distribution, or reproduction of 
this e-mail, including attachments, is prohibited and may be unlawful. If you 
have received this email in error, please notify us immediately by e-mail or 
telephone and delete the e-mail and the attachments (if any).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] FW: parse error

2011-10-13 Thread Stuart Dallas
On 13 Oct 2011, at 18:06, David Savage wrote:

> I'm sorryI need help with php v. 4.3.9 (cgi).  I don't know where else to 
> turn.  I've looked on the php.net web site for details on this particular 
> error, but am unable to find any.
> 
> this is the version I use.
> php -v
> PHP 4.3.9 (cgi) (built: Jun 26 2006 09:46:03)
> Copyright (c) 1997-2004 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
> 
> I run the following command, and getting the following compile error on a 
> linux environment:
> php -l voip_cdrs.php
> PHP Parse error:  parse error, unexpected T_STRING in 
> /usr/local/cytrex/voip_cdrs.php on line 1050
> Errors parsing voip_cdrs.php
> 
> here is a portion of the code that includes the line number mentioned:
> if   ($destlen==11) {
>$start_from_which_offset=1;
> }
> if   ($destlen==10) {
>$start_from_which_offset=0;
> }
> $termnum10=substr($dest, $start_from_which_offset,10);
> $alias_sql_stmt="SELECT ani FROM ldrates WHERE 
> ani='$termnum10'";// <-this is line 1050
> print "$alias_sql_stmt\n";
> $alias_result = $db->sql_query($alias_sql_stmt);
> if  ($alias_result==TRUE) {
>if($db->sql_numrows($alias_result) > 0) {
>print "Found alias...\n";
>continue;
>}
> } else {
>die("problem with sql: $alias_sql_stmt");
> }
> 
> Could you please tell me what's wrong with the line 1050 ?   I've been 
> pulling my hair out (figuratively speaking) trying to understand why the 
> compiler sees this line as a problem.  Thanks for whatever help you can give.

There is nothing wrong with the code you've posted...

stuart@willow:~$ php -l test.php 
No syntax errors detected in test.php

Which means the error is likely above that in the file.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php