RE: [PHP-DB] mysql_fetch_array() doesn't work
change coding to (note, each line is enclosed in quotes and ends withn "."): $query="select user_id, user_name, time, status, comment from users". "where sign=1". "order by user_name". "limit $offset, $step"; print $query; //sanity check...contents of $query $res=mysql_query($query) or die(mysql_error()); //note the die() clause -Original Message- From: Web user [mailto:[EMAIL PROTECTED]] Sent: 27 September 2001 05:48 To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql_fetch_array() doesn't work System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98 When PHP is running at the line: $arr=mysql_fetch_array($res); 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]" 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: - User Added timeStatus"; $num=mysql_num_rows($res); for($i=0; $i<$num; $i++) { $arr=mysql_fetch_array($res); /* HERE is line where the error occurs!!! */ echo " $arr['user_name']>"; echo "$arr['time']"; echo "$arr['status']"; echo "$arr['comment']"; } echo ""; echo ""; /* show others in multi-pages */ for($i=0; $i<$pages; $i++){ echo " echo ($i+1).""; echo " "; } echo ""; ?> - 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' ); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mysql_fetch_array() doesn't work
echo " Missing end quote and semicolon on this line may be the reason... Try properly indenting and formatting your code. Also take advantage of going in and out of php mode to seperate your code from your display of content... Ex: instead of this: $sContent"); ?> Try this: Or even this: It makes it MUCH easier to read and maintain, and seperates the PHP code from the HTML content as much as possible. Any questions, please ask me. -Jason Garber Lead Programmer - www.pulseaday.com [EMAIL PROTECTED] At 12:48 PM 9/27/2001 +0800, you wrote: System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98 When PHP is running at the line: $arr=mysql_fetch_array($res); 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]" 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: User Added timeStatus"; $num=mysql_num_rows($res); for($i=0; $i<$num; $i++) { $arr=mysql_fetch_array($res); /* HERE is line where the error occurs!!! */ echo " $arr['user_name']>"; echo "$arr['time']"; echo "$arr['status']"; echo "$arr['comment']"; } echo ""; echo ""; /* show others in multi-pages */ for($i=0; $i<$pages; $i++){ echo " echo ($i+1).""; echo " "; } echo ""; ?> - 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' ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] mysql_fetch_array() doesn't work
that's not a mysql_fetch_array() error it's a coding error -Original Message- From: Web user [mailto:[EMAIL PROTECTED]] Sent: 27 September 2001 05:48 To: [EMAIL PROTECTED] Subject: [PHP-DB] mysql_fetch_array() doesn't work System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98 When PHP is running at the line: $arr=mysql_fetch_array($res); 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]" 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: - User Added timeStatus"; $num=mysql_num_rows($res); for($i=0; $i<$num; $i++) { $arr=mysql_fetch_array($res); /* HERE is line where the error occurs!!! */ echo " $arr['user_name']>"; echo "$arr['time']"; echo "$arr['status']"; echo "$arr['comment']"; } echo ""; echo ""; /* show others in multi-pages */ for($i=0; $i<$pages; $i++){ echo " echo ($i+1).""; echo " "; } echo ""; ?> - 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' ); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]