$fields = array(); $sql = "SHOW FIELDS FROM ".$acronym; $result = mysql_query($sql); $i = 1; // to skip the id field while ($row = mysql_fetch_array($result)) { $fields[]= $row['Field']; } $str = implode(", ", $fields); echo $str; PHP: This is where it's going to fit: $sql = "INSERT INTO ".$acronym." (".$str.") VALUES (".$strLine[$line].")"; I want to get all the td tags 9/record excluding the ID field inserted.
Add if($row['Field']=="id"){ continue; } after while ($row = mysql_fetch_array($result)) { $fields = array(); $sql = "SHOW FIELDS FROM ".$acronym; $result = mysql_query($sql); $i = 1; // to skip the id field while ($row = mysql_fetch_array($result)) { if($row['Field']=="id"){ continue; } $fields[]= $row['Field']; } $str = implode(", ", $fields); echo $str; Code (markup):