warhead2020 Posted June 18, 2008 Share Posted June 18, 2008 hello,im beginner in php. My problem is,I want to insert the value in my array into the database. Here is my coding. ----------------------------------------------------------------------------------------------------- for($i=5;$i<=10;$i++) { for($j=1;$j<5;$j++) { $satu[$i][$j]=$j; } } for($i=5;$i<=10;$i++) { for($j=1;$j<5;$j++) { $sql="insert into sampling_parameter(mp_fldKodStesen,mp_fldKodCourse,mp_fldWeek,mp_fldWeekActual,mp_fldKumpulan,mp_fldJenisParam,mp_fldBacaan,mp_fldResampling,mp_fldCreTime) values('$satu[$i][$j]','$satu[$i][$j]','$satu[$i][$j]','$satu[$i][$j]','$satu[$i][$j]','$satu[$i][$j]','$satu[$i][$j]','$satu[$i][$j]','$satu[$i][$j]')"; mysql_query($sql); } } ---------------------------------------------------------------------------------------------------- The problem here,it is not the value in the array that are inserted into the column. It works if I use array 1 dimensional. Hope someone out there can understand my question and help me solve this problem. Thanks In advance... Link to comment https://forums.phpfreaks.com/topic/110668-solved-insert-array-2-dimensional-into-table/ Share on other sites More sharing options...
Barand Posted June 18, 2008 Share Posted June 18, 2008 enclose the values in {..}s values('{$satu[$i][$j]}','{$satu[$i][$j]}', etc Link to comment https://forums.phpfreaks.com/topic/110668-solved-insert-array-2-dimensional-into-table/#findComment-567898 Share on other sites More sharing options...
fenway Posted June 18, 2008 Share Posted June 18, 2008 enclose the values in {..}s values('{$satu[$i][$j]}','{$satu[$i][$j]}', etc Wow, you could acutally make sense of that code? Link to comment https://forums.phpfreaks.com/topic/110668-solved-insert-array-2-dimensional-into-table/#findComment-568148 Share on other sites More sharing options...
warhead2020 Posted June 19, 2008 Author Share Posted June 19, 2008 enclose the values in {..}s values('{$satu[$i][$j]}','{$satu[$i][$j]}', etc Thanks!Thanks!Thanks!.... Link to comment https://forums.phpfreaks.com/topic/110668-solved-insert-array-2-dimensional-into-table/#findComment-568682 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.