By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,746 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,746 IT Pros & Developers. It's quick & easy.

PHP Novice question

P: n/a
I m getting a parse error on this snipet of code and I can't understand why:

for ($i=0; i$ < $num_results; $i++)
{
$row = mysql_fetch_row($result)
echo $row[1];
}

It doesn't like the for statement, and it doesn't like the echo $row[1];
I am typing it right out of the manual. What am I doing wrong?
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Michael Jones wrote:
I m getting a parse error on this snipet of code and I can't understand why:

for ($i=0; i$ < $num_results; $i++) ---- should be '$i' instead of 'i$' {
$row = mysql_fetch_row($result) -- where is ';'? echo $row[1];
}

It doesn't like the for statement, and it doesn't like the echo $row[1];
I am typing it right out of the manual. What am I doing wrong?

Jul 17 '05 #2

P: n/a
On 2 Jul 2004 14:17:29 -0700, mi*****************@yahoo.com (Michael Jones)
wrote:
I m getting a parse error on this snipet of code and I can't understand why:

for ($i=0; i$ < $num_results; $i++)
{
$row = mysql_fetch_row($result)
echo $row[1];
}

It doesn't like the for statement, and it doesn't like the echo $row[1];
I am typing it right out of the manual. What am I doing wrong?
Which part of the manual?
What error are you getting?
Which line does it refer to?

One mistake is on the first line:
for ($i=0; i$ < $num_results; $i++)

^^

You mean $i not i$.

(Hm - takes me back to years ago when I was playing with STOS Basic - still
read i$ as 'i' 'string').

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #3

P: n/a

On 2-Jul-2004, mi*****************@yahoo.com (Michael Jones) wrote:
I m getting a parse error on this snipet of code and I can't understand
why:

for ($i=0; i$ < $num_results; $i++)
{
$row = mysql_fetch_row($result)
echo $row[1];
}

It doesn't like the for statement, and it doesn't like the echo $row[1];
I am typing it right out of the manual. What am I doing wrong?


Read the manual more carefully. You are missing a ; at the end of the
mysql_fetch_row() line.

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #4

P: n/a
Thank you SOOO much everyone!!

"Tom Thackrey" <us***********@nospam.com> wrote in message news:<%%*****************@newssvr25.news.prodigy.c om>...
On 2-Jul-2004, mi*****************@yahoo.com (Michael Jones) wrote:
I m getting a parse error on this snipet of code and I can't understand
why:

for ($i=0; i$ < $num_results; $i++)
{
$row = mysql_fetch_row($result)
echo $row[1];
}

It doesn't like the for statement, and it doesn't like the echo $row[1];
I am typing it right out of the manual. What am I doing wrong?


Read the manual more carefully. You are missing a ; at the end of the
mysql_fetch_row() line.

Jul 17 '05 #5

P: n/a
Michael Jones wrote:
I m getting a parse error on this snipet of code and I can't understand
why:

for ($i=0; i$ < $num_results; $i++)
{
$row = mysql_fetch_row($result)
echo $row[1];
}

It doesn't like the for statement, and it doesn't like the echo $row[1];
I am typing it right out of the manual. What am I doing wrong?


Hey, I hope that you come back and read this Michael. You seem like a dorky
new programmer. I am too. I need some PHP buddies. What are you
learning PHP for?
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.