Re: PHP function for listing number of columns in table

From: Date: Mon, 10 Jun 2002 08:39:16 +0000
Subject: Re: PHP function for listing number of columns in table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101372@lists.php.net to get a copy of this message
what's the matter with using mssql_num_fields() and get the answer directly. $fields = mysql_list_fields("$db", "$table", $link); $columns = mysql_num_fields($fields); Hugh ----- Original Message ----- From: "Mark" <maggelet@mminternet.com> To: <Tim.ward@stivesdirect.com>; <webmaster@tececo.com>; <php-general@lists.php.net>; "John Holmes" <holmes072000@charter.net> Sent: Monday, June 10, 2002 1:18 AM Subject: RE: [PHP] PHP function for listing number of columns in table yes, I think getting the result set for 'describe $table' or 'show fields from $table' and then doing mysql_num_rows() on that is best because it will return right away and will work for empty tables as well. On Mon, 10 Jun 2002 09:00:41 +0100, Tim Ward wrote: >Just off the top of my head wouldn't describe then mysql_num_rows() >be a lot >more efficient. > >Tim Ward >www.chessish.com <http://www.chessish.com> >timward@chessish.com <mailto:timward@chessish.com> > > ---------- > From: John Holmes [SMTP:holmes072000@charter.net] > Sent: 09 June 2002 18:29 > To: webmaster@tececo.com; php-general@lists.php.net > Subject: RE: [PHP] PHP function for listing number of columns in >table > > No. There is, however, a function that'll tell you how many columns >are > in a result set. So, if you select all columns, then you can use >that > function to find out how many columns are in the table. > > www.php.net/mysql_num_fields > > ---John Holmes... > > > -----Original Message----- > > From: webmaster@tececo.com [mailto:webmaster@tececo.com] > > Sent: Sunday, June 09, 2002 12:54 AM > > To: php-general@lists.php.net > > Subject: [PHP] PHP function for listing number of columns in table > > > > Pardon the probably stupid question but, > > > > Is there a PHP function for listing number of columns in a mySQL > table? > > > > Thanks in advance > > > > JJ Harrison > > webmaster@tececo.com > > www.tececo.com > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#101372) next »