column names along their headings php mysql -
helo, want print , retrieve column names along headings or catagories title .. i'm using following code print column names:
$arrlength=count($sort); for($x=0;$x<$arrlength;$x++) { echo " <td class=\"tr1 td26\"><p class=\"p12 ft4\">".$sort[$x]."</p></td>"; }
i want print column names along column headings, how can retrieve them if have following table schema: **col heading 1 - col1
col heading 1 - col2 col heading 2 - col1 col heading 2 - col2 col heading 3 - col1 col heading 3 - col2 col heading 3 - col3 col heading 3 - col4 col heading 1 col heading 2 col heading 3 ------------- ------------- ------------------------- col1 col2 col1 col2 col1 col2 col3 col4
i can store column headings in other table can replaced or printed in particular place ..
thankx in anticipation .. ;)
to retrieve column names in php using pdo:
private function showcolumns($table_schema, $table_name){ $stmt = self::$_db->prepare("select column_name, column_key, column_type information_schema.columns table_schema = :table_schema , table_name = :table_name"); $stmt->execute(array(':table_schema' => $table_schema,':table_name' => $table_name)); return $stmt->fetchall(); }
Comments
Post a Comment