Jump to content


Photo

News content


  • Please log in to reply
2 replies to this topic

#1 maxic0

maxic0
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 08 September 2006 - 08:07 PM

Hi, i have another question.. Sorry.

Well on my site i have news content, and when i want it to appear in its box i have to put..

<div id="header"></div>
<div id="content">
<p>Content here!</p>
</div>
<div id="footer"></div>

...But my information is stored in a database.

Can someone please tell me how i would select each piece of info and put it inside the above, so each news content is in a seperate box?

Thanks



#2 maxic0

maxic0
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 09 September 2006 - 12:11 AM

Bump!

#3 jefkin

jefkin
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 09 September 2006 - 12:22 AM

making some assumptions about fields...

<?PHP

#... db connection stuff, query your database table, ... somthing like "SELECT header, content, footer FROM ..."
#... put results in array $results

foreach ($results as $news_item)
{
   ?>
   <div id="header"><?= $news_item['header'] ?></div>
   <div id="content">
      <h4>... other content stuff ...</h4>
      <?= $news_item['content'] ?>
   </div>
   <div id="footer"><?= $news_item['footer'] ?></div>
<?PHP
}
?>

I'm not sure if this is what your after, but hth.

Jeff




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users