hi there, i have a problem with this one, i want to input the data to an array, however, this doesn't work for me.

$resultSN = mysql_query("SELECT * FROM table ");	
	
$resultRowsSN_Count = mysql_query("SELECT COUNT(*) FROM table");
$count = mysql_result($resultRowsSN_Count,0,0);

while($row = mysql_fetch_array($resultSN))
{
   $machineName_O = $row['MachineName'];

     for ($i=0; $i<$count; $i++)
     {
	$machineName[$i] = $machineName_O;
	echo $i. " " . $machineName[$i] . "<br>";
    }
}

with the code above, it displays like this..example
$count = 3
$machineName = a, b, c

$i = 0 - 2

0 a
1 a
2 a
0 b
1 b
2 b
0 c
1 c
2 c

what i want to get is something like this:
$machineName[0] = a
$machineName[1] = b
$machineName[2] = c

could you help me please, i'm stock with this one..thanks in advance ^_^

Try the following.

<?php
$resultSN = mysql_query("SELECT * FROM table ") or die(mysql_error());
$count=mysql_num_rows($resultSN);
$machineName=array();
while($row = mysql_fetch_assoc($resultSN))
{
   $machineName_O = $row['MachineName'];

     for ($i=0; $i<$count; $i++)
     {
	$machineName[] = $machineName_O;
	echo $i. " " . $machineName_O . "<br>";
    }
}
?>

sir, the output is still the same..
0 a
1 a
2 a
0 b
1 b
2 b
0 c
1 c
2 c

U bothe are useing same technique. Don t use insertion and display in same loop

U bothe are useing same technique. Don t use insertion and display in same loop

I assumed the echo was being used as a test and that the insertation was the real deal. But yes recording mysql data into an array should be avoided whenever possible.

okei..sir's thanks for the advices..i already found a solution ^_^