Jump to content

Archived

This topic is now archived and is closed to further replies.

GremlinP1R

Retreving all data.

Recommended Posts

Hi there.

I have a litle problem, I'm pulling out data from a data base and then modifying it with the script.
I use the [color=red]While ($row = $results)[/color] Comand to pull all data from the database thats needed.
Now about 100 lines down I want to display that data. But cant get it to work as it should. as I can only get it to display the first line and not the rest.
I can remember that you get a comand like this +- [color=red]$Cald [] = data;[/color] and then you can retrive that some how...

Can some one please help.  Thanx

Share this post


Link to post
Share on other sites
How do you want to display all the data?  In a table, list form?

try:
 [code=php:0]  $display = "<table><tr><th>Headers</th></tr>";
   
while ($row=$result){
    $display .= "<tr><td>variables</td></tr>";
   }
display .="</table>";
[/code]
Then insert the $display later when needed

Share this post


Link to post
Share on other sites
[quote author=GremlinP1R link=topic=111316.msg451029#msg451029 date=1160675212]
I use the [color=red]While ($row = $results)[/color] Comand to pull all data from the database.
Now about 100 lines down I want to display that data.
[/quote]

About 100 lines down what?  Do you mean you have say 300 rows in your database and you want to display rows 100 to 300 and not 1 to 99?

I'm not sure that you mean by that?

Regards
Huggie

Share this post


Link to post
Share on other sites
I want all data in the database where the colum meets what is searched for.

Like lets take all in month september as an example.

So I have 300 persons thats in september. Now I pull all out of the data base by a row function that's in september and want to create an id (varible) for all of them after modifying the data with the script (the modifying is working 100%) and then later on I want to display all the varibels...

Help I'm stuck here.... Thanx

Share this post


Link to post
Share on other sites
sounds like you need an array:

[code]<?php
$rows_returned = array();
while ($row = mysql_fetch_assoc($resource))
{
  // do your processing

  // add your id to the row variable
  $row['id'] = $id;

  // add this row to the list of returned rows
  $rows_returned[] = $row;
}
?>[/code]

to later output your stuff, use a foreach() loop on $rows_returned wherever you want to output it.  look in the manual for documentation on the foreach() loop.

for any more specific problems, we'll need to see some code.

Share this post


Link to post
Share on other sites

×

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.