$query="INSERT"+" "; for ($i=0;$i<sizeof($col);$i++) { $query+=cols[$i]+" "; } $query+="comment INTO mytable SET";
for ($i=0;$i<sizeof($col);$i++) { $query+=cols[$i]+"="+$cols[$i]+","; } Bye Franciccio "Abrea" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > Dear List, > How can I include a dynamically generated array: > e.g. for($i=0; $i<sizeof($cols); $i++) > { $cols[$i]= mysql_field_name($fields,$i); } > > into a MySQL insert query of the type: > $sql= "INSERT cols[0],cols[1],cols[2], ..., comment > INTO mytable SET > cols[0]= '$cols[0]', > cols[1]= '$cols[1]', > cols[2]= '$cols[2]', > cols[...]= '$cols[...]', > comment= '$comment'"; > > The number of $cols is different for each table. > Thanks in advance for any help > > Alberto Brea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php