View / Download this file.
---------------------------------------------
PTMDB MODULE - db_get_column_count() FUNCTION
---------------------------------------------
------------
USAGE FORMAT
------------
Where $count is the returned number of columns:
$count = &db_get_column_count($db_object, $table_name);
$count = &db_get_column_count($db_object, $table_name, $db_name);
-----------
DESCRIPTION
-----------
Returns the number of columns in the given database table.
---------
ARGUMENTS
---------
$db_object
REQUIRED
A database handler object. This object stores connection information and
is returned from a db_connect() function call. This object is of the same
type as is returned by a DBI->connect function call.
$table_name
REQUIRED
The name of the table from which you would like to pull column data.
$db_name
OPTIONAL / REQUIRED
The name of the database from which to pull table column data. This is
only required if a database has not yet been selected using the
db_select_database() function or an SQL 'USE' statement, or alternately if
you wish to pull table column headers from a different database than the
one currently selected.
-------
RETURNS
-------
The number of columns in the selected database table.
--------------
USAGE EXAMPLES
--------------
--------------------------------------------------------------
Example 1: Displaying the Number of Columns in Table 'MyTable'
--------------------------------------------------------------
<?= &db_get_column_count($dbobj, 'MyTable') =?>
|