Spiew Posted April 26, 2013 Share Posted April 26, 2013 Hello, I just came across a problem... This if my first post on this website since I just found out about it. Hopefully I could get some help from here since you seem to be the real deal and uses PDO! I want to echo out the title, category & content from database. I know how to do this, but not how to make them editable for me. Hard to explain but this is an example: (This is how it looks now when I'm echoing out the title,category & content using a while loop.) TitleCategoryContent (I want them to appear like this so I can fix them up to look nice in a container) Title Category Content here Here's my code http://pastebin.com/Lg5YebgZ Thanks in advanced Quote Link to comment https://forums.phpfreaks.com/topic/277341-selecting-data-from-db-appear-in-different-divs/ Share on other sites More sharing options...
Barand Posted April 26, 2013 Share Posted April 26, 2013 Just output the required HTML code with your db data. eg echo "<div><p>$title</p><p>$category</p><p>$content</p></div>"; Quote Link to comment https://forums.phpfreaks.com/topic/277341-selecting-data-from-db-appear-in-different-divs/#findComment-1426774 Share on other sites More sharing options...
Spiew Posted April 26, 2013 Author Share Posted April 26, 2013 That won't work because I get all the titles, categories & content from the database. Same thing now when I use the while loop. I want the title to be displayed in a black bar, with the category right below it and then content . All this is one container (as one post). Then I want the latest 5 posts to look like this. Quote Link to comment https://forums.phpfreaks.com/topic/277341-selecting-data-from-db-appear-in-different-divs/#findComment-1426776 Share on other sites More sharing options...
Barand Posted April 26, 2013 Share Posted April 26, 2013 That was an example, as stated, not the solution. Create the HTML to look as as you want it, then output that same HTML + data from the PHP code as demonstrated in the example. Quote Link to comment https://forums.phpfreaks.com/topic/277341-selecting-data-from-db-appear-in-different-divs/#findComment-1426783 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.