Skip to content

Instantly share code, notes, and snippets.

@bhowe
Created December 23, 2015 02:54
Show Gist options
  • Select an option

  • Save bhowe/892434add32e825fd72a to your computer and use it in GitHub Desktop.

Select an option

Save bhowe/892434add32e825fd72a to your computer and use it in GitHub Desktop.
Show all the columns names in a table
$result = mysql_query("SHOW COLUMNS FROM TABLENAME");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
echo $row['Field']."<br>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment