foreach ( $tbl_one_data as $row_ ) {
$id = ( int ) $row_ [0];
$time = mysql_real_escape_string ( $row_ [1] );
$callid = mysql_real_escape_string ( $row_ [2] );
$queuename = mysql_real_escape_string ( $row_ [3] );
$arrayValues [] = "($id, '$time','$callid','$queuename',";
}
}
I am trying to improve the above code with the code below:
$b = 0;
foreach ( $tbl_one_data as $row_ ) {
if ($b < count ( $row_ )) {
${"var" . $b} = mysql_escape_string ( $row_ [$b] );
$b ++;
}
}
My question is how would I add the dynamic variables created into the array incrementally to achieve something like this:
$arrayValues [] = "('$var0','$var1','$var2','$var3'"; ??
$arrayValues [] = "('${"var" . $b}',"; doesn't seem to have the same effect as in my first code snippet.