Re: retrieving field names in ascending order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Hope:

On 9/8/05, hope <umeed921@xxxxxxxxx> wrote:
> how can i retrieve field names from a table(e.g products_attributes)
>  in ascending order???
> i need to display each of the fieldnames alongwith its datatype and length
> on the page.
I suppose you use Mysql:

$result=mysql_query("SHOW COLUMNS FROM table",$db);
if (mysql_num_rows($result) > 0) {
  while ($row = mysql_fetch_assoc($result)) {
		$k[$row['Field']]=$row['Type'];
  }
  ksort($k);
  while (list($key,$value)=each($k)) echo "$key $value<br>\n";
}

Pablo.
-- 
Pablo M. Rivas. http://www.pmrivas.com http://www.r3soft.com.ar
-----------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux