Hi, can i ask is it possible to insert this in my table
suppose i have this function addgroup($groupname,$groupsize,$grouplevel)
now those parameters in addgroup function are posted in array
how do insert them to my table ?
I tried to use foreach but i did not achieve it gives me syntax error.
function addgroup($groupname,$groupsize,$grouplevel){
foreach($groupname as $gp,$groupsize as $gpsize, $grouplevel as $gplevel){
Insert statement here ................
}
}
I use foreach so that i can extract the values and insert them in my table during loop…This is okay if it’s only one parameter but how do I solved that kind of problem with multiple parameter and with and array of values?
I would suggest building your arrays with common keys, then use this key to get matching values.
<?php
//As a sample, build each array with a common loop. Either assign a common KEY or leave blank.
$groupname[] = "BIG GROUP";
$groupsize[] = "BIG";
$grouplevel[] = "FIRST CLASS";
//These "arrays" will all have a common KEY of 0
// Use thses common keys to identify matching values
function addgroup($groupname,$groupsize,$grouplevel){
foreach($groupname as $groupKEY => $gp){
$gpsize = $groupsize[$groupKEY];
$gplevel = $grouplevel[$groupKEY];
//Insert statement here ................
}
}
?>