Hello Hope:

On 9/8/05, hope <[EMAIL PROTECTED]> 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

Reply via email to