Hey,
http://www.php.net/manual/en/function.mysql-fetch-array.php

regarding, jb at stormvision dot com dot na's post (below)

i need to output
&row0=article__2|aaaa|tipo 1:&row1=art2|bbbbb|Tipo 2

how can i achieve this?

This might be usefull for people that work with lots of rows and want to place them all into one array for later usage. This script just takes care of all the tedious work one would have and puts all neccessary field names into your array automatically. This way you can use this script over and over for all kind of mysql functions.
$result=mysql_query("select * from mydata order by 'id'")or die('died');
$num_rows = mysql_num_rows($result);
$j=0;
$x=1;
while($row=mysql_fetch_array($result)){
for($j=0;$j<$num_rows;$j++){
$name = mysql_field_name($result, $j);
$object[$x][$name]=$row[$name];
}$x++;
}

For Later in the script you may use the below array to gain access to your data

$i=1;
$ii=count($object); //quick access function
for($i=1;$i<=$ii;$i++){
echo $object[$i]['your_field_name'];
}

hope it helps






Kindest Regards,
Pedro Furtado
www.silkonski.com

Reply via email to