Blank Failing

From: Date: Thu, 27 Jan 2000 14:43:16 +0000
Subject: Blank Failing
Groups: php.general 
Request: Send a blank email to php-general+get-15125@lists.php.net to get a copy of this message
Hi folks there is a file and there is datas at this format username name surname serial I wrote a script to take username, name and surname from this text and it is working with this format but when I change the format like username name surname serial ( there is two blank character after username ) it cant read if you have an idea please tell me the script is: <?php $file = "/home/db/file.txt"; $fp = fopen ("$file","r"); printf("<table border=1>\n"); printf("<tr>\n"); printf("<td><b>Adi</b></td><td><b>Soyadi</b></td><td><b>GüvenlikNo</b></td>"); printf("</tr>\n"); while (!feof($fp)) { $buffer = chop(trim(fgets($fp,1024))); $pieces = explode(" ",$buffer); if (strlen($buffer) > 0) printf("<tr>\n"); while (list($key,$val) = each($pieces)) { if ( ($key == 0 || $key == 1 || $key == 4) && strlen($val) > 0) printf ("<td>$val</td>",$key,$val); flush(); } if (strlen($buffer) > 0) printf("\n</tr>\n"); } printf("</table>\n"); fclose($fp); ?> file is cat /home/db/file.txt Serhat Artun 05322714044 Serial001 Guvenlik001 Ali Kaya 0532120584 Serial004 Guvenlik004 Volkan Erzurumlu 02163026673 Serial020 Guvenlik020

« previous php.general (#15125) next »