Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/23775-retreving-all-data/
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
Link to comment
https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-107989
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
Link to comment
https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-108242
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
Link to comment
https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-109888
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.
Link to comment
https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-109895
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.