Concatenate PHP code into a string

From: Date: Mon, 28 Jun 2004 19:31:30 +0000
Subject: Concatenate PHP code into a string
Groups: php.general 
Request: Send a blank email to php-general+get-189174@lists.php.net to get a copy of this message
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

« previous php.general (#189174) next »