At 20.03.2002  16:29, you wrote:
>
>
>
>Hii,
>
>Actually i want to sort the files form mysql database using php
>sorting.I can get the correct result using php sorting if the data's are
>stored in the array like this format.
>
>  $temp=array("apple","Orange","Gova")
>
>please tell me how i will store the field details in a array fetched from
>mysql database
even if you could sort the data with the correct select
f.e. select * from your_db where something='tru' order by 
the_field_you_wnt_to_sort,

the method you requested is something like
while($res=result_from_db_select)
(sorry for result_from_db_select but as Iīm using objects for 
databaseactions, I
donīt know the exact commands maybe mysql_fetch_row)
{
for($i=0; $i < count($res); $i++) // counts all fields that come back
{
         $temp[$i] = $res[$i];
}
}
if you have a named array, you could also use an array for the names
f.e. $arraynames=array("first_col","second_col","third_col")
the your code would like
while($res=result_from_db_select)
{
for($i=0; $i < count($res); $i++) // counts all fields that come back
{
         $temp[$arraynames[$i]] = $res[$i];
}
}
HTH Oliver



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to