GremlinP1R Posted October 12, 2006 Share Posted October 12, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/23775-retreving-all-data/ Share on other sites More sharing options...
komquat Posted October 12, 2006 Share Posted October 12, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-107989 Share on other sites More sharing options...
HuggieBear Posted October 13, 2006 Share Posted October 13, 2006 [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?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-108242 Share on other sites More sharing options...
GremlinP1R Posted October 17, 2006 Author Share Posted October 17, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-109888 Share on other sites More sharing options...
akitchin Posted October 17, 2006 Share Posted October 17, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/23775-retreving-all-data/#findComment-109895 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.