note 10283 modified in function.mysql-num-fields by felipe

From: Date: Tue, 22 Jul 2008 03:01:43 +0000
Subject: note 10283 modified in function.mysql-num-fields by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142475@lists.php.net to get a copy of this message
If you just want the number of fields in a table, you can do something like this: <?php $db_id = mysql_connet(); $result = mysql_query("DESCRIBE [tableName], $db_id); $numFields = mysql_num_rows($result); ?> Because "DESCRIBE" returns one row for each field in the table (at least in MySQL), this will work. --was-- If you just want the number of fields in a table, you can do something like this: -- $db_id = mysql_connet(); $result = mysql_query("DESCRIBE [tableName], $db_id); $numFields = mysql_num_rows($result); -- Because "DESCRIBE" returns one row for each field in the table (at least in MySQL), this will work. http://php.net/manual/en/function.mysql-num-fields.php

« previous php.notes (#142475) next »