Jump to content

Problem displaying results using PHP from select query


jonfsbrighton

Recommended Posts

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

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.