Hello everyone,

I'm a true beguiner on php but i'm still giving it a try, I've to build a website that will be constantly updated with news, so I tought that somehow the best way to do it is to instert all the data on the database and let it create a div with it.

I've created 3 div classes( .smallsize ; .medsize ; .maxsize) with its sizes and everything on the css, and I want them to appear on the div with id="news".

the table for that news is structured this way( news_id>title>text>image)

so what i tought was:
smallsize class would get only the image;
medsize class would get the title and image;
maxsize class would get the title image and text.

so basically what I need to know first of all is how do I make the code to generate a div everytime a news is added to the database, with one of those 3 classes, getting that elements that I mentioned above. inside the div with id="news"

Thank you alot,
Gonçalo Pereira

    Welcome to PHPBuilder!

    I'm not sure you're thinking like I might think about this. I don't care about creating a new DIV each time something is added to the database. I tend to care more about the page load; that is, I want my news page to have current news whenever someone loads my news site.

    This would be a matter of writing a page that opens a Database connection, reads the current stories and associated metadata, and outputs HTML to the browser including the appropriate data.

    Now, is that what you mean?

    Or, do you actually foresee that people will have a web browser continually open to your page, and reporters/personnel will be adding stories while they have their browser open, and so they might miss something new? That's a little different way of thinking about it, and I'm not sure that statistics would indicate this is really an issue to think about. I suppose if you're really worried about that, you could set a JavaScript timer in the page to refresh it after $n minutes ...

      Write a Reply...