Forum Moderators: coopster

Message Too Old, No Replies

Array Questions

passing, index and returning values of array

         

kenchix1

7:29 am on Jul 8, 2005 (gmt 0)

10+ Year Member



I read 10 lines of data from the database and I'd like to put it in an array. My problems are :

(1)
if the way of putting values inside an array is like this :
$arr = array(1 => "string1", 2 => "string2", 3 => "string3");
or
$arr = array("string1", "string2", "string3");

then how can I insert the values inside an array coming from :

while(list($stringdata)= mysql_fetch_row($result))
{
---------------------
}

(2)
How do I pass the whole array to another array variable?

Thanks.

coopster

1:03 pm on Jul 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can create/modify with square-bracket syntax [php.net]:
$table_info = array(); 
while ($row = mysql_fetch_row($rows)) {
$table_info[] = $row;
}