<?php $fp = fopen('data.txt','r'); if (!$fp) {echo 'ERROR: Unable to open file.'; exit;}
while (!feof($fp)) { $line = fgets($fp, 1024); //use 2048 if very long lines list ($field1, $field2, $field3) = split ('\|', $line); echo ' <div><a href="'.$field1.'">'.$field2.'<br><img src="'.$field3.'"></a></div>'; $fp++; }
fclose($fp);
?>
my text database code per line
Code:
URL|NAME|IMAGE
how can i get the data (more that 1 line) to show up side by side for a set number before starting a new one. (all images will be the same size, and at the moment it shows the information line after line.
(I have not used tables but i think that the tables will be the only way to go for what I want.)
Tables aren't necessary, but they're commonly used. You just need to modify your loop. For example, if you want it to show three links/images per line:
PHP Code:
$i = 0; while(!feof($fp)) { $i++; /* Do your stuff */ if(($i % 3)==0) { // End your table row here. } }
There are a couple small things this doesn't take into account, but you get the idea
__________________
Chris Duerr
AddonChat Java Chat Software
What does your web server error log say? Any warnings generated? If you view the source do you just see empty table data? Throw in some print() commands to see where it's stopping.
__________________
Chris Duerr
AddonChat Java Chat Software
Please login or register to view this content. Registration is FREE - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
That should solve your problem if I'm understanding it correctly. Let me know.
__________________
Please login or register to view this content. Registration is FREE - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.