RE: [PHP] Re: Cry for help

2002-09-13 Thread joakim . andersson

 For example:
 
 while (!feof ($fp))
 
 What does the ! mean or do?

! means not.

 What does feof mean? is it one command? or is f e o f all different?

feof() is a function that checks if a file has reached the end or not. (eof
= end of file)

while (!feof ($fp)) in whole means something like this
As long as the filepointer ($fp) is not at the end, do whatever that's
between { and } over and over again...

 Why are there 2 ) at the end?

Just because :-)
The first ) belongs to feof and the second ) belongs to while.

 
 $buffer = fgets($fp, 4096);
 
 Why does it need a buffer? What is a buffer?

$buffer is just a variable that stores the result of fgets(). It could be
any name really...

 
 $arr = explode(|, $buffer);
 
 It's questions like that. I can understand more or less what 
 the meanings
 are of the concepts. Another example of this is, I tested 
 your code, and it
 returned the string
 
 SangiovanneseFlorentia Viola
 
 on one line only. If I want it to look like this:?
 
 Sangiovannese
 Florentia Viola
 
 Now i now the \n means to go to the next line, but where 
 would I put that?

You modify this line
echo $arr[4];
to this
echo $arr[4] . \n; // The . is a string concatenation operator. It simply
joins the two strings.

Now this would give you the same result in your browser, but if you view the
source in the browser you will see that the lines are separated. To do a
line break in the browser you have to insert the correct html (br)
instead.

 You see my dilemmas no? I wish I could find a list of syntax 
 and functions
 like a reference guide. That would be a start

www.php.net/manual/en/ is a very good start.

 
 Tack again
 -Tree

Varsågod!
Joakim

 
 - Original Message -
 From: Joakim Andersson [EMAIL PROTECTED]
 Newsgroups: php.general
 To: [EMAIL PROTECTED]
 Sent: Thursday, September 12, 2002 4:54 PM
 Subject: RE: [PHP] Re: Cry for help
 
 
   |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
   |Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
  
   So for example, lets say I wanted to make another html form
   that has a form
   field for List team by: and and select either home or 
 away ... by
   selecting home, the browser would print out the following:
  
   Sangiovannese
   Gualdo
  
   so now I need to figure out how to get PHP to do the following:
  
   #1 look at each line in the text file and treat it individually
   #2 select the data after the 4th | from each line
   #3 print it back to the browser
 
  $fd = fopen (/tmp/inputfile.txt, r); // Opens file for reading
  while (!feof ($fd)) // Start of loop.
  {
  $buffer = fgets($fd, 4096); // Reads one line of 
 maximum 4096 bytes
  $arr = explode(|, $buffer); // Divides each row into separate
 elements
  in an array.
  echo $arr[4]; // Prints the 5th element of each row.
  // The first element ($arr[0]) is actually  (an empty 
 string) since each
  line starts with |.
  }
  fclose ($fd);
 
  Hopefully this will get you in the right direction.
  Regards
  Joakim Andersson
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: Cry for help

2002-09-12 Thread Jay Blanchard

[snip]
As far as Apache is concerned, I looked at the website, yet couldnt find the
exact server software, so if you could provide me with a direct link I'd
appreciate it. It would be to my benefit however, if I could not only serve
myself html pages as http:// but also as file:// as internet costs here are
ridiculously high (no unilimited $24.99 2/7 packages here yet)
[/snip]

When you install apache locally (on your own system) you will be serving
pages as http:// locally. Should help you to cut down on those unreal
internet costs.

What OS are you running now? Give us that and we can point you to a link.

HTH! Peace ...

Jay



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Cry for help

2002-09-12 Thread Chad Winger

Thanks for the reply :P

I found it actually. Now I have the apache and php running, and am able to
run my aforementioned test script locally. I am still looking through the
manual now for the syntaxes and such. I am also looking on the web for some
simple prewritten scripts to run and then try to dissect and deconstruct.

With my little test script I've written, there are a few things I'd like
to be able to try to do with it that I think would help my learning process
go on more smoothly, but i cant seem to figure out, what functions to even
begin to try to use.

I'll give an example.

This is the result of my little test script as printed into a txt file.

|Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola

So if i fill out the form again, and resubmit, i might get something like
this:

|Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
|Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola

So for example, lets say I wanted to make another html form that has a form
field for List team by: and and select either home or away ... by
selecting home, the browser would print out the following:

Sangiovannese
Gualdo

so now I need to figure out how to get PHP to do the following:

#1 look at each line in the text file and treat it individually
#2 select the data after the 4th | from each line
#3 print it back to the browser

It's simple things like this that will get me going. I know for guys like
you, it would take about 3 minutes to type that up but to me its a little
tough trying to figure out how and where to use what. This manual isnt the
most well put together in my opinion, its tough to locate things. So if
someone or something would say to mewell for that operation, you need to
create function_whatever, then run a so_and_so then I could go to the
manual, and then learn how to write it. So this is my problem right now,
basically not knowing WHAT to learn first.

Thoughts?

Thanks again

-Tree
- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
Newsgroups: php.general
To: 'Chad Winger' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, September 12, 2002 3:01 PM
Subject: RE: [PHP] Re: Cry for help


 [snip]
 As far as Apache is concerned, I looked at the website, yet couldnt find
the
 exact server software, so if you could provide me with a direct link I'd
 appreciate it. It would be to my benefit however, if I could not only
serve
 myself html pages as http:// but also as file:// as internet costs here
are
 ridiculously high (no unilimited $24.99 2/7 packages here yet)
 [/snip]

 When you install apache locally (on your own system) you will be serving
 pages as http:// locally. Should help you to cut down on those unreal
 internet costs.

 What OS are you running now? Give us that and we can point you to a link.

 HTH! Peace ...

 Jay


Jay Blanchard [EMAIL PROTECTED] wrote in message
001901c25a5c$797161c0$8102a8c0@000347D72515">news:001901c25a5c$797161c0$8102a8c0@000347D72515...
 [snip]
 As far as Apache is concerned, I looked at the website, yet couldnt find
the
 exact server software, so if you could provide me with a direct link I'd
 appreciate it. It would be to my benefit however, if I could not only
serve
 myself html pages as http:// but also as file:// as internet costs here
are
 ridiculously high (no unilimited $24.99 2/7 packages here yet)
 [/snip]

 When you install apache locally (on your own system) you will be serving
 pages as http:// locally. Should help you to cut down on those unreal
 internet costs.

 What OS are you running now? Give us that and we can point you to a link.

 HTH! Peace ...

 Jay





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Cry for help

2002-09-12 Thread Adam Williams

You can use PHP and file() to do with, along with the str functions, but
if I were you and you already know what the filename of the file is you
are working on (or can submit it via a form) I would use the unix command
cut to do the operations on the file.  Use another exec() or system() and
have it run cut -d | -f 4 yourfile.txt and then return you the output.

Adam

On Thu, 12 Sep 2002, Chad Winger wrote:

 Thanks for the reply :P

 I found it actually. Now I have the apache and php running, and am able to
 run my aforementioned test script locally. I am still looking through the
 manual now for the syntaxes and such. I am also looking on the web for some
 simple prewritten scripts to run and then try to dissect and deconstruct.

 With my little test script I've written, there are a few things I'd like
 to be able to try to do with it that I think would help my learning process
 go on more smoothly, but i cant seem to figure out, what functions to even
 begin to try to use.

 I'll give an example.

 This is the result of my little test script as printed into a txt file.

 |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola

 So if i fill out the form again, and resubmit, i might get something like
 this:

 |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
 |Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola

 So for example, lets say I wanted to make another html form that has a form
 field for List team by: and and select either home or away ... by
 selecting home, the browser would print out the following:

 Sangiovannese
 Gualdo

 so now I need to figure out how to get PHP to do the following:

 #1 look at each line in the text file and treat it individually
 #2 select the data after the 4th | from each line
 #3 print it back to the browser

 It's simple things like this that will get me going. I know for guys like
 you, it would take about 3 minutes to type that up but to me its a little
 tough trying to figure out how and where to use what. This manual isnt the
 most well put together in my opinion, its tough to locate things. So if
 someone or something would say to mewell for that operation, you need to
 create function_whatever, then run a so_and_so then I could go to the
 manual, and then learn how to write it. So this is my problem right now,
 basically not knowing WHAT to learn first.

 Thoughts?

 Thanks again

 -Tree
 - Original Message -
 From: Jay Blanchard [EMAIL PROTECTED]
 Newsgroups: php.general
 To: 'Chad Winger' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Thursday, September 12, 2002 3:01 PM
 Subject: RE: [PHP] Re: Cry for help


  [snip]
  As far as Apache is concerned, I looked at the website, yet couldnt find
 the
  exact server software, so if you could provide me with a direct link I'd
  appreciate it. It would be to my benefit however, if I could not only
 serve
  myself html pages as http:// but also as file:// as internet costs here
 are
  ridiculously high (no unilimited $24.99 2/7 packages here yet)
  [/snip]
 
  When you install apache locally (on your own system) you will be serving
  pages as http:// locally. Should help you to cut down on those unreal
  internet costs.
 
  What OS are you running now? Give us that and we can point you to a link.
 
  HTH! Peace ...
 
  Jay
 
 
 Jay Blanchard [EMAIL PROTECTED] wrote in message
 001901c25a5c$797161c0$8102a8c0@000347D72515">news:001901c25a5c$797161c0$8102a8c0@000347D72515...
  [snip]
  As far as Apache is concerned, I looked at the website, yet couldnt find
 the
  exact server software, so if you could provide me with a direct link I'd
  appreciate it. It would be to my benefit however, if I could not only
 serve
  myself html pages as http:// but also as file:// as internet costs here
 are
  ridiculously high (no unilimited $24.99 2/7 packages here yet)
  [/snip]
 
  When you install apache locally (on your own system) you will be serving
  pages as http:// locally. Should help you to cut down on those unreal
  internet costs.
 
  What OS are you running now? Give us that and we can point you to a link.
 
  HTH! Peace ...
 
  Jay
 
 






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Cry for help

2002-09-12 Thread Chad Winger

I have no idea what that means, sorry :)

My point for wanting to do this isnt because I really want to make a list of
the home teams or whatnot. But obviously, at some point, I am going to have
to learn how to split different bits of information, how organize them in
certain ways, in certain orders etc. So if i can figure out how to get PHP
to select the certain bits of info, and then organize them, say,
alphabetically, that will teach me how to write some syntax, to use a few
different functions and to begin how to set variables.

in 85 when i had the old Apple IIe I was able to do stuff like this with the
if A$=whatever then goto ...  type stuff and it was easy back then. Now i
realize PHP is not BASIC, nor am I a little kid anymore, but the basic idea
of what i'd like to learn to do is there. So if i can just get used to
working with it, then it will come

-Tree

Adam Williams [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You can use PHP and file() to do with, along with the str functions, but
 if I were you and you already know what the filename of the file is you
 are working on (or can submit it via a form) I would use the unix command
 cut to do the operations on the file.  Use another exec() or system() and
 have it run cut -d | -f 4 yourfile.txt and then return you the output.

 Adam

 On Thu, 12 Sep 2002, Chad Winger wrote:

  Thanks for the reply :P
 
  I found it actually. Now I have the apache and php running, and am able
to
  run my aforementioned test script locally. I am still looking through
the
  manual now for the syntaxes and such. I am also looking on the web for
some
  simple prewritten scripts to run and then try to dissect and
deconstruct.
 
  With my little test script I've written, there are a few things I'd
like
  to be able to try to do with it that I think would help my learning
process
  go on more smoothly, but i cant seem to figure out, what functions to
even
  begin to try to use.
 
  I'll give an example.
 
  This is the result of my little test script as printed into a txt
file.
 
  |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
 
  So if i fill out the form again, and resubmit, i might get something
like
  this:
 
  |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
  |Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
 
  So for example, lets say I wanted to make another html form that has a
form
  field for List team by: and and select either home or away ... by
  selecting home, the browser would print out the following:
 
  Sangiovannese
  Gualdo
 
  so now I need to figure out how to get PHP to do the following:
 
  #1 look at each line in the text file and treat it individually
  #2 select the data after the 4th | from each line
  #3 print it back to the browser
 
  It's simple things like this that will get me going. I know for guys
like
  you, it would take about 3 minutes to type that up but to me its a
little
  tough trying to figure out how and where to use what. This manual isnt
the
  most well put together in my opinion, its tough to locate things. So if
  someone or something would say to mewell for that operation, you need
to
  create function_whatever, then run a so_and_so then I could go to the
  manual, and then learn how to write it. So this is my problem right now,
  basically not knowing WHAT to learn first.
 
  Thoughts?
 
  Thanks again
 
  -Tree
  - Original Message -
  From: Jay Blanchard [EMAIL PROTECTED]
  Newsgroups: php.general
  To: 'Chad Winger' [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Thursday, September 12, 2002 3:01 PM
  Subject: RE: [PHP] Re: Cry for help
 
 
   [snip]
   As far as Apache is concerned, I looked at the website, yet couldnt
find
  the
   exact server software, so if you could provide me with a direct link
I'd
   appreciate it. It would be to my benefit however, if I could not only
  serve
   myself html pages as http:// but also as file:// as internet costs
here
  are
   ridiculously high (no unilimited $24.99 2/7 packages here yet)
   [/snip]
  
   When you install apache locally (on your own system) you will be
serving
   pages as http:// locally. Should help you to cut down on those unreal
   internet costs.
  
   What OS are you running now? Give us that and we can point you to a
link.
  
   HTH! Peace ...
  
   Jay
  
  
  Jay Blanchard [EMAIL PROTECTED] wrote in message
  001901c25a5c$797161c0$8102a8c0@000347D72515">news:001901c25a5c$797161c0$8102a8c0@000347D72515...
   [snip]
   As far as Apache is concerned, I looked at the website, yet couldnt
find
  the
   exact server software, so if you could provide me with a direct link
I'd
   appreciate it. It would be to my benefit however, if I could not only
  serve
   myself html pages as http:// but also as file:// as internet costs
here
  are
   ridiculously high (no unilimited $24.99 2/7 packages here yet)
   [/snip]
  
   When you install apache locally (on your

RE: [PHP] Re: Cry for help

2002-09-12 Thread Will Steffen

Heh - I know how you feel.

I'm an ex network tecchie fighting my way through a career change to web
developer - spent some time messing with various scripting tools and so
forth, but never really had any formal coding experience until I hit php
- if you want some advice on learning php mine is spend the next few
weeks/months just soaking up every tutorial you can lay your hands on -
the best libraries are on phpbuilder, devshed and zend imho - altho
webmonkey also has a couple of really 'beginner' ones (hello world
country) you might want to start out with.

Also one thing no-one ever really tells you about this is that one of
the most important things to learn if you plan on building sites with
php is not php - its html.  I know this is a bit duh!, but seriously -
php is about logical structures - and slapping together a few variables
- it aint that hard once you get in the groove, but if you don't know
your html well enough to handcode it and to deconstruct a fat mess of
tags in your head and visualize what its going to end up looking like on
screen - you're going to have a hard time coding scripts to generate the
stuff.


0.02 - actual mileage may vary - insert coin to generate more bs

Cheers
Will

 -Original Message-
 From: Chad Winger [mailto:[EMAIL PROTECTED]] 
 Sent: 12 September 2002 03:34 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: Cry for help
 
 
 I have no idea what that means, sorry :)
 
 My point for wanting to do this isnt because I really want to 
 make a list of the home teams or whatnot. But obviously, at 
 some point, I am going to have to learn how to split 
 different bits of information, how organize them in certain 
 ways, in certain orders etc. So if i can figure out how to 
 get PHP to select the certain bits of info, and then organize 
 them, say, alphabetically, that will teach me how to write 
 some syntax, to use a few different functions and to begin 
 how to set variables.
 
 in 85 when i had the old Apple IIe I was able to do stuff 
 like this with the if A$=whatever then goto ...  type stuff 
 and it was easy back then. Now i realize PHP is not BASIC, 
 nor am I a little kid anymore, but the basic idea of what i'd 
 like to learn to do is there. So if i can just get used to 
 working with it, then it will come
 
 -Tree
 
 Adam Williams [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 te.ms.us...
  You can use PHP and file() to do with, along with the str 
 functions, 
  but if I were you and you already know what the filename of 
 the file 
  is you are working on (or can submit it via a form) I would use the 
  unix command cut to do the operations on the file.  Use 
 another exec() 
  or system() and have it run cut -d | -f 4 yourfile.txt and 
 then return 
  you the output.
 
  Adam
 
  On Thu, 12 Sep 2002, Chad Winger wrote:
 
   Thanks for the reply :P
  
   I found it actually. Now I have the apache and php 
 running, and am 
   able
 to
   run my aforementioned test script locally. I am still looking 
   through
 the
   manual now for the syntaxes and such. I am also looking 
 on the web 
   for
 some
   simple prewritten scripts to run and then try to dissect and
 deconstruct.
  
   With my little test script I've written, there are a few things 
   I'd
 like
   to be able to try to do with it that I think would help 
 my learning
 process
   go on more smoothly, but i cant seem to figure out, what 
 functions 
   to
 even
   begin to try to use.
  
   I'll give an example.
  
   This is the result of my little test script as printed 
 into a txt
 file.
  
   |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
  
   So if i fill out the form again, and resubmit, i might 
 get something
 like
   this:
  
   |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia 
 Viola Serie 
   |C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
  
   So for example, lets say I wanted to make another html 
 form that has 
   a
 form
   field for List team by: and and select either home or 
 away ... 
   by selecting home, the browser would print out the following:
  
   Sangiovannese
   Gualdo
  
   so now I need to figure out how to get PHP to do the following:
  
   #1 look at each line in the text file and treat it 
 individually #2 
   select the data after the 4th | from each line #3 print 
 it back to 
   the browser
  
   It's simple things like this that will get me going. I 
 know for guys
 like
   you, it would take about 3 minutes to type that up but to me its a
 little
   tough trying to figure out how and where to use what. This manual 
   isnt
 the
   most well put together in my opinion, its tough to locate 
 things. So 
   if someone or something would say to mewell for that 
 operation, you 
   need
 to
   create function_whatever, then run a so_and_so then I could go to 
   the manual, and then learn how to write it. So this is my problem 
   right now, basically not knowing WHAT to learn first.
  
   Thoughts?
  
   Thanks

Re: [PHP] Re: Cry for help

2002-09-12 Thread Chad Winger

Html is something i do in my sleep :P thankfully I've been good enough with
it to make a decent living with it. What you mention is quite logical, as i
would find myself correcting the ppl coding the databases and/or scripts by
saying, stuff like you realize that when the info is returned like that you
are going to need four colums in the html, not 3... and they'd be like,
geez..your right...and then they'd have to go back and code again...

So i am hoping that the html part that i know helps me gets me thru the
scripting phase a little easier, although the languages are apples and
oranges

iom looking thru the tuts now :P

cheers

-Tree


Will Steffen [EMAIL PROTECTED] wrote in message
000c01c25a63$e616a0e0$8000a8c0@william">news:000c01c25a63$e616a0e0$8000a8c0@william...
 Heh - I know how you feel.

 I'm an ex network tecchie fighting my way through a career change to web
 developer - spent some time messing with various scripting tools and so
 forth, but never really had any formal coding experience until I hit php
 - if you want some advice on learning php mine is spend the next few
 weeks/months just soaking up every tutorial you can lay your hands on -
 the best libraries are on phpbuilder, devshed and zend imho - altho
 webmonkey also has a couple of really 'beginner' ones (hello world
 country) you might want to start out with.

 Also one thing no-one ever really tells you about this is that one of
 the most important things to learn if you plan on building sites with
 php is not php - its html.  I know this is a bit duh!, but seriously -
 php is about logical structures - and slapping together a few variables
 - it aint that hard once you get in the groove, but if you don't know
 your html well enough to handcode it and to deconstruct a fat mess of
 tags in your head and visualize what its going to end up looking like on
 screen - you're going to have a hard time coding scripts to generate the
 stuff.


 0.02 - actual mileage may vary - insert coin to generate more bs

 Cheers
 Will

  -Original Message-
  From: Chad Winger [mailto:[EMAIL PROTECTED]]
  Sent: 12 September 2002 03:34 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Re: Cry for help
 
 
  I have no idea what that means, sorry :)
 
  My point for wanting to do this isnt because I really want to
  make a list of the home teams or whatnot. But obviously, at
  some point, I am going to have to learn how to split
  different bits of information, how organize them in certain
  ways, in certain orders etc. So if i can figure out how to
  get PHP to select the certain bits of info, and then organize
  them, say, alphabetically, that will teach me how to write
  some syntax, to use a few different functions and to begin
  how to set variables.
 
  in 85 when i had the old Apple IIe I was able to do stuff
  like this with the if A$=whatever then goto ...  type stuff
  and it was easy back then. Now i realize PHP is not BASIC,
  nor am I a little kid anymore, but the basic idea of what i'd
  like to learn to do is there. So if i can just get used to
  working with it, then it will come
 
  -Tree
 
  Adam Williams [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
  te.ms.us...
   You can use PHP and file() to do with, along with the str
  functions,
   but if I were you and you already know what the filename of
  the file
   is you are working on (or can submit it via a form) I would use the
   unix command cut to do the operations on the file.  Use
  another exec()
   or system() and have it run cut -d | -f 4 yourfile.txt and
  then return
   you the output.
  
   Adam
  
   On Thu, 12 Sep 2002, Chad Winger wrote:
  
Thanks for the reply :P
   
I found it actually. Now I have the apache and php
  running, and am
able
  to
run my aforementioned test script locally. I am still looking
through
  the
manual now for the syntaxes and such. I am also looking
  on the web
for
  some
simple prewritten scripts to run and then try to dissect and
  deconstruct.
   
With my little test script I've written, there are a few things
I'd
  like
to be able to try to do with it that I think would help
  my learning
  process
go on more smoothly, but i cant seem to figure out, what
  functions
to
  even
begin to try to use.
   
I'll give an example.
   
This is the result of my little test script as printed
  into a txt
  file.
   
|Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
   
So if i fill out the form again, and resubmit, i might
  get something
  like
this:
   
|Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia
  Viola Serie
|C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
   
So for example, lets say I wanted to make another html
  form that has
a
  form
field for List team by: and and select either home or
  away ...
by selecting home, the browser would print out the following:
   
Sangiovannese
  

RE: [PHP] Re: Cry for help

2002-09-12 Thread Will Steffen

Heh good so you're not a complete n00b then :P  Luckily I had a fairly
decent grounding in html and css as well when I got going - I'm just
putting the finishing touches on my first serious project atm using OO
style php which made the learning curve about 10 times steeper as I had
no previous experience with an OO language and the OO tuts as you will
find are pretty thin on the ground and of varying quality - thinking of
writing a few myself when I get a breather :-)

GL and happy reading :-)

Cheers
Will

 -Original Message-
 From: Chad Winger [mailto:[EMAIL PROTECTED]] 
 Sent: 12 September 2002 04:00 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Re: Cry for help
 
 
 Html is something i do in my sleep :P thankfully I've been 
 good enough with it to make a decent living with it. What you 
 mention is quite logical, as i would find myself correcting 
 the ppl coding the databases and/or scripts by saying, stuff 
 like you realize that when the info is returned like that 
 you are going to need four colums in the html, not 3... and 
 they'd be like, geez..your right...and then they'd have to go 
 back and code again...
 
 So i am hoping that the html part that i know helps me gets 
 me thru the scripting phase a little easier, although the 
 languages are apples and oranges
 
 iom looking thru the tuts now :P
 
 cheers
 
 -Tree


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: Cry for help

2002-09-12 Thread joakim . andersson

 |Serie C2 Round 2|09.09.02|20.45|Sangiovannese|Florentia Viola
 |Serie C2 Round 2|09.09.02|20.45|Gualdo|Florentia Viola
 
 So for example, lets say I wanted to make another html form 
 that has a form
 field for List team by: and and select either home or away ... by
 selecting home, the browser would print out the following:
 
 Sangiovannese
 Gualdo
 
 so now I need to figure out how to get PHP to do the following:
 
 #1 look at each line in the text file and treat it individually
 #2 select the data after the 4th | from each line
 #3 print it back to the browser

$fd = fopen (/tmp/inputfile.txt, r); // Opens file for reading
while (!feof ($fd)) // Start of loop.
{
$buffer = fgets($fd, 4096); // Reads one line of maximum 4096 bytes
$arr = explode(|, $buffer); // Divides each row into separate elements
in an array.
echo $arr[4]; // Prints the 5th element of each row.
// The first element ($arr[0]) is actually  (an empty string) since each
line starts with |.
}
fclose ($fd);

Hopefully this will get you in the right direction.
Regards
Joakim Andersson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php