I have written a program to insert an array in all the rows of a column in a database table with respect to already filled column in the same database same table. 

But it doesn't seems to work properly. Please tell me where I am going wrong! 

```
$query = $sql = "SELECT A FROM `table`";
$result1 = mysql_query($query); 
while ($row = mysql_fetch_row($result1)) {

foreach($output as $value){
$count=sizeof($value); 

for($counter=0;$counter<$count;$counter++)
{

$query= "INSERT INTO `TABLE` (`B`) VALUES ('" . $value . "') WHERE A= $row[$counter] ";

$insert_col= mysql_query($query);

echo $query;
echo '<br/><br/>';
  }} 

} 

```

Where `$output` is an array contains the array value as follows:

```
$output[0]= RD 3.56 , $output[1]= RD 5.56 , $output[2]= RD 4.86 

```

When I run my program, to check my the query .. the output comes like this:

```
INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.144') WHERE A= 3r_1 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 2.436') WHERE A= 3r_1 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.624') WHERE A= 3r_1 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_1 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_1 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_1 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.144') WHERE A= 3r_2 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 2.436') WHERE A= 3r_2 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.624') WHERE A= 3r_2 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_2 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_2 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_2 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.144') WHERE A= 3r_3 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 2.436') WHERE A= 3r_3 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.624') WHERE A= 3r_3 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_3 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_3 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_3 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.144') WHERE A= 3r_4 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 2.436') WHERE A= 3r_4 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.624') WHERE A= 3r_4 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_4 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_4 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.60') WHERE A= 3r_4 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.144') WHERE A= 3r_5 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 2.436') WHERE A= 3r_5 

INSERT INTO `TABLE` (`B`) VALUES (' RD: 1.624') WHERE A= 3r_5

```

Please help! i am going mad with this bug in my program for almost more than a week.

The output should look like this

```
INSERT INTO 'TABLE' SET B = ' RD: 1.144' WHERE A = '3r_1' 

INSERT INTO 'TABLE' SET B = ' RD: 2.436' WHERE A = '3r_2' 

INSERT INTO 'TABLE' SET B = ' RD: 1.624' WHERE A = '3r_3' 

INSERT INTO 'TABLE' SET B = ' RD: 1.560' WHERE A = '3r_4' 

INSERT INTO 'TABLE' SET B = ' RD: 1.560' WHERE A = '3r_5' 

INSERT INTO 'TABLE' SET B = ' RD: 1.560' WHERE A = '3r_6'

```

The problem here is `$row` value is repeated 6 times for all the `$output` values. How can I solve the problem?

And after lot of trials, I got to know that the problem is in calling the arrays. So, if anyone can tell me how to call the two arrays at the same time w.r.t the code written above, I would be very grateful.