php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13468 Always show "T_STRING' or `T_VARIABLE' or"
Submitted: 2001-09-27 11:42 UTC Modified: 2001-10-02 09:24 UTC
From: random11 at telekbird dot com dot cn Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.6 OS: Win 98 SE Chinese Ver
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: random11 at telekbird dot com dot cn
New email:
PHP Version: OS:

 

 [2001-09-27 11:42 UTC] random11 at telekbird dot com dot cn
System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98 SE Chinese Version

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always shows info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

What's the problem wiht mysql_fetch_array() or other?
What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean?

THANKS
Mike


The full code below:
----------------------------------------------------------------------------

<?
$link=mysql_connect("localhost","","");
if($link==false){
echo "Failed linking to database.";
exit();
}
$handler=mysql_select_db("database1");
if($handler==false)
echo "Failed linking to database.";
$query="select count(*) from users where sign=1";
$res=mysql_query($query);
$row=mysql_fetch_row($res);
$all=$row[0];
$step=5;
$pages=ceil($all/$step);       /*the number of pages needed to listed */
if(empty($offset))
$offset=0;
$query="select user_id, user_name, time, status, comment from users
where sign=1
order by user_name
limit $offset, $step";
$res=mysql_query($query);
echo "<table><td align=center>User</td>
<td align=center>Added time</td><td align=center>Status</td></tr>";
$num=mysql_num_rows($res);
for($i=0; $i<$num; $i++) {
$arr=mysql_fetch_array($res);   /* HERE is line where the error occurs!!!
*/
echo "<tr><td align=center><a href=\"profile.php?id=$arr['user_id']\"
target='_top'>$arr['user_name']</a>></td>";
echo "<td align=center>$arr['time']</td>";
echo "<td align=center>$arr['status']</td></tr>";
echo "<tr><td colspan=3>$arr['comment']</td></tr>";
}

echo "</table><br><br><br>";

echo "<table><tr><td align='center'>";  /* show others in multi-pages */
for($i=0; $i<$pages; $i++){
echo "<a href='$PHP_SELF?offset=$i*$step' target='_top'>";
echo ($i+1)."</a>";
echo "&nbsp;&nbsp;";
}
echo "</td></tr></table>";

?>

----------------------------------------------------------------------------
-
create table users (
user_id int not null auto_increment primary key,
user_name varchar(30),
time datetime,
status tinyint(1),
comment text,
sign tinyint(1) default '1'
);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-02 09:07 UTC] random11 at telekbird dot com dot cn
Sorry, it is not a bug!
I  finally found the reason for why does  the IE always show info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

It is because the echo (including print) doesn't work at the line
below,
echo "<tr><td><a href=\"profile.php?id=$arr['user_id']\"  target='_top'>";
showing the error info as I mentioned. ( but it should work according to PHP books)

It only works when  the $arr['user_id'] is out of the quotes.
echo "<tr><td><a href=\"profile.php?id=".$arr['user_id']."\"
target='_top'>";
then IE showed no error any longer.

So I have to let all $arr['key']  out of the quotes, then the scripts are Ok.

 [2001-10-02 09:08 UTC] random11 at telekbird dot com dot cn
Sorry, it is not a bug!
I  finally found the reason for why does  the IE always show info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

It is because the echo (including print) doesn't work at the line
below,
echo "<tr><td><a href=\"profile.php?id=$arr['user_id']\"  target='_top'>";
showing the error info as I mentioned. ( but it should work according to PHP books)

It only works when  the $arr['user_id'] is out of the quotes.
echo "<tr><td><a href=\"profile.php?id=".$arr['user_id']."\"
target='_top'>";
then IE showed no error any longer.

So I have to let all $arr['key']  out of the quotes, then the scripts are Ok.

 [2001-10-02 09:10 UTC] derick@php.net
Not a bug, and BTW, this:

echo "<tr><td><a href=\"profile.php?id={$arr['user_id']}\" target='_top'>";

works too. (Use { } around it)

Derick
 [2001-10-02 09:10 UTC] random11 at telekbird dot com dot cn
Sorry, it is not a bug!
I  finally found the reason for why does  the IE always show info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

It is because the echo (including print) doesn't work at the line
below,
echo "<tr><td><a href=\"profile.php?id=$arr['user_id']\"  target='_top'>";
showing the error info as I mentioned. ( but it should work according to PHP books)

It only works when  the $arr['user_id'] is out of the quotes.
echo "<tr><td><a href=\"profile.php?id=".$arr['user_id']."\"
target='_top'>";
then IE showed no error any longer.

So I have to let all $arr['key']  out of the quotes, then the scripts are Ok.

 [2001-10-02 09:11 UTC] derick@php.net
Bogus, and do not open it again please.

Derick
 [2001-10-02 09:18 UTC] random11 at telekbird dot com dot cn
Thank you, Derick!

MIKE

 [2001-10-02 09:24 UTC] mfischer@php.net
Muha :) Again bogusified. Do not respond.

- Markus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 22:01:31 2024 UTC