Formatting SQL Data having inserted it into HTML (Webpage) using PHP -


hello stackoverflow community, can provided once again wonderful interllectuals!

problem - i've created db connection, i've queried db, , i've turned results associative array. displaying sql data using php trouble i'm having. i've managed display in basic way, aim information display 'news column' down side of page, , therefore need data inserted divs me able manipulate.

attempt far - 1 can see below, presentation of attempt display data cringeworthy. in way did manage distinguish types of headings each piece of data.

    echo "<h2>" . $row["title"]. "</h2><h3>date: " . $row["datetime"]. "</h3><h4>passage: " . $row["passage"]. "</h4><br>"; 

html current webpage:

http://i.imgur.com/9u1twkd.png (what 'news column' looks like) http://i.imgur.com/1tga0sx.png (my html code want data inputted into) - aim able complete form (http://i.imgur.com/0xmnovb.png) , data go db (done this), , display in column 'title' appearing in right place, same 'date' , 'passage'.

what i've found online:

i dislike wasting people's time i've spent few hours searching online. far i've found people creating html tables sql data, great , all, i've not found who's using divs/headings/paragraphs etc...

my css:

i have css file i'm retrieving (or whatever term is) via html code working (so far).

i'd thank attempting answer question in advance, it's great able fall-back on website when i'm in dire need of help.

best,

jake

interestingly, seem have components need: example of how markup (the html) needs outputted , db query , data inject it. unless i'm missing (it's possible!), remains glue 2 together.

assuming form represented in recent graphic generated within .php file can either pre-build giant variable containing markup necessary render output, or write static html , insert dynamic elements using native php (php templating language of sorts).

using latter method you'd following (forgive different css class names , tag hierarchy, can't copy/paste png :-)

<div class="wrapper"> <?php foreach($myresult $row): ?> <div class="article> <h3><?php echo $row['title']; ?></h3> <div class="date"><?php echo $row['date']; ?></div> <p><?php echo $row['body']; ?></p> <div> <?php endforeach; ?> </div>


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -