473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PHP Novice question

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
5 1401
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
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

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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Christopher Richards | last post by:
It is possible to be able to receive email alerts (say, from Google News) and publish them to a web page automatically? I am a novice as far as PHP goes, but I can open and write to a file and...
5
by: Marian | last post by:
Hi, I am totaly novice in .NET and I am studying a book about this. There was mentioned "assembly". I did not understand, how function does it has . I would like to know the exact run of code...
2
by: George | last post by:
Is this group for a novice C++ programmers?
21
by: AES/newspost | last post by:
My understanding -- I'm not an expert -- is that on (some? many? all?) standard Internet servers a URL can point to a subdirectory name followed by a backslash, and that links to this URL will...
6
by: ronwer | last post by:
Hello, The title doesn't completely cover the question I have, but it's a bit more complicated problem we have. We are using a database, based on Acces, but developed by a third party...
3
by: herrcho | last post by:
Here is the code.. #define NAME "MEGATHINK, INC" #define ADDRESS "10 Megabuck Plaza" #define PLACE "Megapolis, CA 94904" int main() { starbar(); printf("%s\n",NAME);
2
by: Dmitry Sazonov | last post by:
I'm novice here and I'm sorry for stupid question. We are trying to understand web services architecture, is it better than TIBCO.Randevouz and does webservices fit our needs. I understand, I...
1
by: Christo | last post by:
I have a question please this is just theory at the moment I am a novice java programmer Is it possible for me to write information to a hashmap and then once it has been written to extract a...
1
by: TwistedSpanner | last post by:
Hello all, For the record I am a complete java novice. I have to write a program to generate/output to screen 10 simple maths question and output a final score . The question is as follows ...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.