Hi Ramiro,

Your code looks ok, why don't you try the following and tell me is 
working or not

$arr_aantal = explode (",", $aantal);
$arr_str_men = explode (",", $str_men);
$arr_recht = explode (",", $recht);
$arr_rechtverstek = explode (",", $rechtverstek);
$arr_verstekgelijk = explode (",", $verstekgelijk);
$arr_verstekongelijk = explode (",", $verstekongelijk);
rows = count($arr_aantal);

for($b=0; $b<$rows; $b++):
  $sql = "INSERT INTO $table_name SET aantal='". trim($arr_aantal[$b]) ."',str_men='" 
. trim($arr_str_men[$b]) ."',recht ='"
.. trim($arr_recht[$b]) ."',rechtverstek='" . trim($arr_rechtverstek[$b])
.."',verstekgelijk='" . trim($arr_verstekgelijk[$b]) ."',verstekongelijk='" .
trim($arr_verstekongelijk                       [$b]) . "', soorten=
'$bewaar'";
      mysql_query ($sql)
                 or die ("cannot execute update query");
}

only change I made was to use the count from explode.


Ramiro Radjiman wrote:

> I have the following code:
> 
> $arr_aantal = explode (",", $aantal);
> $arr_str_men = explode (",", $str_men);
> $arr_recht = explode (",", $recht);
> $arr_rechtverstek = explode (",", $rechtverstek);
> $arr_verstekgelijk = explode (",", $verstekgelijk);
> $arr_verstekongelijk = explode (",", $verstekongelijk);
> 
> for($b=0; $b<$rows; $b+=1){
>                 $sql = "INSERT INTO " . $table_name . " SET aantal='" .
> trim($arr_aantal[$b]) ."',str_men='" . trim($arr_str_men[$b]) ."',recht ='"
> .. trim($arr_recht[$b]) ."',rechtverstek='" . trim($arr_rechtverstek[$b])
> .."',verstekgelijk='" . trim($arr_verstekgelijk[$b]) ."',verstekongelijk='" .
> trim($arr_verstekongelijk                       [$b]) . "', soorten=
> '$bewaar'";
> 
>                 mysql_query ($sql)
>                  or die ("cannot execute update query");
> }
> 
> if i do this the following sql statement is created,
> 
> 
> INSERT INTO testen SET
> aantal='22',str_men='2',recht='2',rechtverstek='2',verstekgelijk='2',verstek
> ongelijk='2',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> INSERT INTO testen SET
> aantal='',str_men='',recht='',rechtverstek='',verstekgelijk='',verstekongeli
> jk='',soorten='plat3mm'
> 
> 
> so the first array element goes wel, but the next contains no data, but i
> know for sure that there is dat in it. See above.
> 
> Could anyone give me a clue?
> 
> aantal=$arr_aantal[$b]   should work i thaught.
> or
>  "aantal= ". $arr_aantal[$b] ." str_men=" . $arr_str_men[$b] . and so fort.
> 
> 
> 
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to