[nycphp-talk] for() question
Rafi Sheikh
Rafi.Sheikh at Ingenix.com
Tue Apr 20 14:24:27 EDT 2004
Hi List.
My status: Brain dead
NEEDED: How do I assign the retrieved data to unique arrays?
Henry and Dan form this list helped me to get at this stage where I am
retrieving the data from a mysql table.
Now, It is very embarrassing but after I get the data read in (code below),
I for the love of PHP, can not make unique rows or dynamically assign the
data. I tried the following:
$plot=array();
$i=0;
while ($row = mysql_fetch_assoc($resultID)) {
foreach($row as $field) {
$plot[$i]=$field;
$i++;
}
It seems to either go to the last row of data, or if I do:
$data1=$array[0]);
or so, I get one line which is fine but than, as soon I do:
$data1=$array[0];
$data2=$array[1];
... more like this...
than at 4th or 5th $data5, etc. it tells me that it is undefined (going back
to where all the data was read in the first iteration-I think)
WHAT I AM TRYING TO DO:
All I need is that the data I get read in (thx H & D), to get it assigned to
an array dynamically or manually per row, which becomes my one set of data
that I could use. So If I had 10 rows, I will get 10 unique arrays that I
could use with jpgraph for a multi-line graph.
I am afraid my novice status in PHP is not letting me write or understand a
better "for or do..while" code that could do the job. Can you help?
Rafi
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified that
any dissemination, distribution or copying of this e-mail is prohibited. If
you have received this e-mail in error, please notify the sender by replying
to this message and delete this e-mail immediately.
More information about the talk
mailing list