jonfsbrighton Posted December 3, 2007 Share Posted December 3, 2007 Hi there, I am a little stuck and was wondering whether anyone would be able to point me in the right direction. I am building a video forum website and I am currently trying to create my categories page. The problem I have is that I have created a wicked CSS style to display the list of question headings for the user to browse and select from. The questions are stored within the database under 'postcontent'. The only way I know how to extract the question titles and display this is as follows: Run a mysql select query and extract the postcontent results, then loop through the database and extract all entries the postcontent records within the database. Then on my main categories page I would echo the postcontent results and voila . . . I have my results . . . . The problem I have is that I want to display each record within the postcontent result separately on the page, and not simply echoed out in a table with the results listed one after the other. Does anyone have any thoughts or tutorials they can direct me towards to solve this? Cheers Jon Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 3, 2007 Share Posted December 3, 2007 By the sound of things you will need some sort of pagination script. Am i right in saying you want one category on a page and then have a next button to scroll through. If so check out php freaks tutorials. There is a pagination tutorial there. Quote Link to comment Share on other sites More sharing options...
jonfsbrighton Posted December 3, 2007 Author Share Posted December 3, 2007 Hi there, Yes I will need to add paging to my page, I want to display 10 question titles and then have a next button to display the next set of records. That link will be very helpful thanks. However I still am unsure of how to layout my results. Basically when I extract my data using the select statement, it loops through the database and stores all the question titles under postcontent, then when I echo the post content variable on my cat page it displays all the questions as one lump block. What I want to do is to extract each record within postcontent variable and display them in different parts of the page . . . . I am thinking able arrays would this be the correct avenue to go down? Cheers for your help Jon Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 3, 2007 Share Posted December 3, 2007 Here is the link http://www.phpfreaks.com/tutorials/43/0.php. Get you information from the database and store each record as an array. Then you can echo each individual array on the page where you want. Something like $result = mysql_query("SELECT * FROM albums"); while($row = mysql_fetch_array($result)) { echo $row['album_name']; echo "<br />"; } The above code only prints out my album names. Quote Link to comment 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.