Jump to content

problem with echo function


Sebolains

Recommended Posts

Hi. I have a very simple databse in .txt . I very simply display it in my website. Now: the problem is that I need to display them every 2. I mean: the fisr one must be aligned to the left, the second one to the right, the third one to the left, and so on. How can I do this? There is a lot of aligning involved, not just <align="left">. I figure I have to echo every to entries. How do I do this?

Thanks a lot!!

Link to comment
https://forums.phpfreaks.com/topic/80547-problem-with-echo-function/
Share on other sites

OK. Here's the code:

<?php
$file= 'season1.txt';
$handle = fopen($file, 'r');
$Data = fread($handle, 8192);
fclose($handle);
$lines=explode("\n",$Data);
foreach ($lines as $line) {
  list($ID, $name, $description, $url)=explode('|',$line);
  echo '<a href="?p='.$ID.'"><img src="lib/episodes/'.$ID.'.jpg" align="left" border="0"></a><p class="date"><a href="?p='.$ID.'">'.$ID.' - '.$name.'</a></p><p>'.$description.'</p><br>';
}
?>

 

The image has then to be aligned to right, and so should both <p>.

 

Thanks a lot! Sorry if I came out rude. I seriously wasn't.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.