# Php/mysql insert

**URL:** <https://forum.kirupa.com/t/php-mysql-insert/256082>\
**Category:** Uncategorized\
**Created:** [March 30, 2008, 1:36pm UTC](https://forum.kirupa.com/t/php-mysql-insert/256082 "2008-03-30T13:36:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Utech22](https://avatars.discourse-cdn.com/v4/letter/u/f17d59/32.png) [@Utech22](https://forum.kirupa.com/u/Utech22)\
**Post date:** [March 30, 2008, 1:36pm UTC](https://forum.kirupa.com/t/php-mysql-insert/256082/1 "2008-03-30T13:36:47Z")

</div>

I am displaying a form fields ‘$amount times’ (4 times) and want the value to go to the database ‘$amount times’ (4 times) . Such that form feilds 1,form feilds 2 & form feilds 3  
are inserted into the table all at once.

```php
 
$amount = 4;
for ($i=0;$i<$amount;$i++)
    {
     $queryE = ( "insert into table(value1,value2,value3) 
     values('$value1','$value2','$value3')");  
     mysql_query($queryE);  
 
    }

```

With this code only the last value (form field 3) is inserted, Why?
