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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.