It's not the most elegant way, but it works:
<?php
function sqlite_field_names($db, $tablename){
$sq5=sqlite_single_query($db, "SELECT sql FROM sqlite_master WHERE tbl_name='".$tablename."'", SQLITE_NUM);
$kommando=$sq5[0];
$cut=strtok($kommando,"(");
while($fieldnames[]=strtok(",")) {};
array_pop($fieldnames);
foreach($fieldnames as $no => $field)
if (strpos($field, "PRIMARY KEY")){
strtok($field,"(");
$primary=strtok(")");
unset($fieldnames[$no]);
} else
$fieldnames[$no]=strtok($field, " ");
return $fieldnames;
}
?>