Re: I need help!!!
| From: | Michael Kelley | Date: | Thu, 17 May 2001 15:19:50 +0000 |
| Subject: | Re: I need help!!! | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-7677@lists.php.net to get a copy of this message | ||
They way I handled something like this was, I read the line in with fread breaking it up into "$chunks"
$chunk1 = fread( $fp, 12); //Your string#1
$chunk2 = fread( $fp, 11); //The URL
$chunk3 = fread( $fp, 5); //the INT
$chunk4 = fread( $fp, 50); //The final StringThen when building the next page I would make a link by using this syntax printf("<td><center><a href=\"%s\">%s</a></center></td>",$chunk1,$Chunk2); Since you're reading in multiple lines at a time I'd read them into an array $i=0; while ( !feof($fp)) { $chunk1[$i] = fread( $fp, 12); //Your string#1 $chunk2[$i] = fread( $fp, 11); //The URL $chunk3[$i] = fread( $fp, 5); //the INT $chunk4[$i] = fread( $fp, 50); //The final String global $i;//Since we use $i outside the while make it global $i++; } then print from an array for ($j=0; $j<$i; $j++) { printf("<td><center><a href=\"%s\">%s</a></center></td>",$chunk1[$J],$Chunk2[$J]); } Alain Menard wrote:
I clicked on the send button to fast... The part that i'm having problem with is the second part. Especially the one about the first string becomming a link to the corresponding URL. ""Alain Menard"" <menard.alain@videotron.ca> wrote in message news:9dv3k5$873$1@toye.p.sourceforge.net...-- Michael Kelley mkelley@nmsu.edu Programmer/Systems Analyst I New Mexico State University Information and Communication Technologies Work # (505)-646-1374 P.O. Box 30001 MSC: 3AT Las Cruces, NM 88003Hi!! I'm presently working on my personal web site and i would like to use PHPtodo the following : 1- Read a string in the following format from a text file :string;url;integer;string string;url;integer;string string;url;integer;string ... string;url;integer;string2- Generate a page containing the resulting list in the following format :string integer string string integer string string integer string ... string integer stringwhere the first string is a link to the corresponding url.Any help would be welcome at this point. Thank you in advance... Alain Menard -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net