knaiblis Posted August 1, 2008 Report Share Posted August 1, 2008 Problēma sekojoša. Mēģinu uzraksti skriptu kas no *.txt faila tabula ataino ierakstus, bet katru reizi tiek izdots par 1 rindinu vairak neka ir *.txt failaa. if($fp = fopen($litotajudb, 'r+')) { $ligner = 1; echo '<br>'; echo '<br>'; echo '<table align="center" border="1" bordercolor="#00CCFF" width="700">'; echo '<tr align="center"><td>ID</td><td>Lietotājs</td><td>Parole MD5</td><td>Pēdējo reizi ienācis</td></td><td>Labot</td> </tr>'; while (!feof($fp)) { $data = fgets($fp); list ($ID, $name, $tow, $obj ) = explode(',', $data, 4); echo '<tr>'; echo '<td align="center" > ', $ID, '</td>'; echo '<td align="center" >', $name, ' </td>'; echo '<td align="center" > ', $tow, '</td>'; echo '<td align="center" > ', $obj, '</td>'; echo '<td align="center" > <input type="submit" value="Labot"> </td>'; echo '</tr>'; echo $ligner; $ligner++; } echo '</table>'; fclose($fp); } else { exit('Error : open impossible file'); } Link to comment Share on other sites More sharing options...
andrisp Posted August 1, 2008 Report Share Posted August 1, 2008 Visticamāk faila beigās ir pārnesums uz jaunu rindu (\n). Tas ir, tukša rinda. Ieliec pārbaudi. if (trim($data) != '') { // ir dati } Link to comment Share on other sites More sharing options...
knaiblis Posted August 1, 2008 Author Report Share Posted August 1, 2008 Paldies. viss tagad darbojas korekti. Link to comment Share on other sites More sharing options...
Recommended Posts