Grabbed and tweaked from php.net 🙂
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$fields = mysql_list_fields("dbnamehere", "tbnamehere", $link);
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
$field .= mysql_field_name($fields, $i).", ";
}
$field1 = str_replace(strrchr($field, ", "), "", $field);
//$field1 is now a string with all the fields using a comma as a delimiter
//eg: field1, field2, field3, blah...
$field2 = str_replace(", password field here", "", $field1);
//now $field2 should be the full list without the password field
//just load it into a new select query:
$query = mysql_query("SELECT $field2 FROM tablename") or die(mysql_error());