amazing syntax error

amazing syntax error

am 28.12.2005 16:50:02 von dean

Amazing. Maybe more a PHP problem.

This little phscript works perfect with PHP 5.0 and Mysql 5.0 ...under
Windows with IE and Netscape 8.0. Exactly the
same script gives a syntax error on line: b= (little green arrow
pointing to and Netscape 7.2 under Linux (redhat 9.0).

The script code:

$link = mysql_connect("localhost", "root", "pw")
or die("Impossible de se connecter : " . mysql_error());
$dbsel = mysql_select_db('mydb', $link);
$sql = "SELECT logon, number FROM mytable";
$result = mysql_query($sql);
$rec=mysql_num_rows($result);
echo $rec; // = 12
?>









(Variable $rec = 12 )

I really don't know what's wrong with this code ...
Do you?
Thanks
Dean

Re: amazing syntax error

am 28.12.2005 17:01:19 von Ewoud Dronkert

Dean wrote:
>
>
>
>
> (Variable $rec = 12 )
>
> I really don't know what's wrong with this code ...

Well, you haven't said whether you're getting a PHP syntax error or a
JavaScript error. If it's JavaScript error, then the PHP has nothing to
do with it, and vice versa. Either way, it's nothing to do with MySQL
(this is evident from the fact that echo $rec; gives a value).

In future, please learn to narrow down the possible causes, and post to
appropriate groups accordingly, as well as snipping irrelevant bits of code.


Note that whether you're able to use tags is
configuration-dependent, namely "short tags" option. Look it up in the
manual...

--
Oli

Re: amazing syntax error

am 28.12.2005 17:02:08 von Hilarion

Dean wrote:

> Amazing. Maybe more a PHP problem.
>
> This little phscript works perfect with PHP 5.0 and Mysql 5.0 ...under
> Windows with IE and Netscape 8.0. Exactly the
> same script gives a syntax error on line: b= (little green arrow
> pointing to > and Netscape 7.2 under Linux (redhat 9.0).
>
> The script code:
>
> > $link = mysql_connect("localhost", "root", "pw")
> or die("Impossible de se connecter : " . mysql_error());
> $dbsel = mysql_select_db('mydb', $link);
> $sql = "SELECT logon, number FROM mytable";
> $result = mysql_query($sql);
> $rec=mysql_num_rows($result);
> echo $rec; // = 12
> ?>
>
>
>
>
>
> (Variable $rec = 12 )
>
> I really don't know what's wrong with this code ...
> Do you?
> Thanks
> Dean

The error is not related to PHP version, MySQL version, your OS or
(PHP errors never are) to the browser. The problem is probably
related to your PHP settings. In the first case (when the script
works) you have short tags turned on, and in the second case
you have short tag turned off.
Read about "short_open_tag" setting in "php.ini" (or --enable-short-tags
configuration directive).

In general usage of short tags is discouraged because it makes
your script less portable (it will not work with short tags turned
off).

Change this:

b = ;

to this:

b =

and the script will work regardless of short tags being on or off.
(Also do not use " not only "

Hilarion

Re: amazing syntax error

am 28.12.2005 17:09:52 von dean

Thanks for your friendly explanation.


"Hilarion" schreef in bericht
news:douctm$6um$1@news.onet.pl...
> Dean wrote:
>
>> Amazing. Maybe more a PHP problem.
>>
>> This little phscript works perfect with PHP 5.0 and Mysql 5.0 ...under
>> Windows with IE and Netscape 8.0. Exactly the
>> same script gives a syntax error on line: b= (little green arrow
>> pointing to >> and Netscape 7.2 under Linux (redhat 9.0).
>>
>> The script code:
>>
>> >> $link = mysql_connect("localhost", "root", "pw")
>> or die("Impossible de se connecter : " . mysql_error());
>> $dbsel = mysql_select_db('mydb', $link);
>> $sql = "SELECT logon, number FROM mytable";
>> $result = mysql_query($sql);
>> $rec=mysql_num_rows($result);
>> echo $rec; // = 12
>> ?>
>>
>>
>>
>>
>>
>> (Variable $rec = 12 )
>>
>> I really don't know what's wrong with this code ...
>> Do you?
>> Thanks
>> Dean
>
> The error is not related to PHP version, MySQL version, your OS or
> (PHP errors never are) to the browser. The problem is probably
> related to your PHP settings. In the first case (when the script
> works) you have short tags turned on, and in the second case
> you have short tag turned off.
> Read about "short_open_tag" setting in "php.ini" (or --enable-short-tags
> configuration directive).
>
> In general usage of short tags is discouraged because it makes
> your script less portable (it will not work with short tags turned
> off).
>
> Change this:
>
> b = ;
>
> to this:
>
> b =
>
> and the script will work regardless of short tags being on or off.
> (Also do not use " > not only " >
>
> Hilarion

Re: amazing syntax error

am 09.10.2007 19:09:07 von unknown

Post removed (X-No-Archive: yes)

Re: amazing syntax error

am 09.10.2007 19:19:59 von Good Man

"Gregory Nickoloff" wrote in
news:LPOdnWtP4_36KJbanZ2dnUVZ_sLinZ2d@buckeye-express.com:

> Are you saying it runs correctly on one server configuration but not
> the other, or that the different configurations you mention are
> different client setups being served?

that was an "amazing" thread pickup! last previous response, December
2005!!!

Re: amazing syntax error

am 10.10.2007 10:54:02 von John Hosking

Good Man wrote:
> "Gregory Nickoloff" wrote in
> news:LPOdnWtP4_36KJbanZ2dnUVZ_sLinZ2d@buckeye-express.com:
>
>> Are you saying it runs correctly on one server configuration but not
>> the other, or that the different configurations you mention are
>> different client setups being served?
>
> that was an "amazing" thread pickup! last previous response, December
> 2005!!!

He's improving; over in a.w.webmaster he's been responding to posts from
May of this year. If he keeps this up, in a week he'll be replying to
threads from 1997.

:-P

--
John

Re: amazing syntax error

am 16.10.2007 03:24:34 von David McKenzie

John Hosking wrote:
> Good Man wrote:
>> "Gregory Nickoloff" wrote in
>> news:LPOdnWtP4_36KJbanZ2dnUVZ_sLinZ2d@buckeye-express.com:
>>> Are you saying it runs correctly on one server configuration but not
>>> the other, or that the different configurations you mention are
>>> different client setups being served?
>>
>> that was an "amazing" thread pickup! last previous response, December
>> 2005!!!
>
> He's improving; over in a.w.webmaster he's been responding to posts from
> May of this year. If he keeps this up, in a week he'll be replying to
> threads from 1997.
>
> :-P
>
Re: WorldWideWeb: Summary
Dear Tim Berners-Lee,

Thanks for telling us about the WorldWideWeb, any idea when this will be
implemented?

Thanks,
Gregory Nickoloff

--
DM davidm@cia.com.au

'It would go against respecting principles and truth if you have to
respect and accept anything just because it is the other side's view.'
- Kim Jung Ill