note 16413 deleted from ref.odbc by jimw

From: Date: Mon, 29 Oct 2001 20:05:31 +0000
Subject: note 16413 deleted from ref.odbc by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19578@lists.php.net to get a copy of this message
Hi, I have written a function that returns all the tables/fields of your current odbc connection. /* odbc_all (int connection_id) Description: The odbc_all() function which is available from PHP 3.06 to PHP 3.0.16 along with PHP 4.0 and higher returns all the tables of your open connection. */ function odbc_all($odbc_db){ $tablelist = odbc_tables($odbc_db); $i = 0; while(odbc_fetch_row($tablelist)){ if (odbc_result($tablelist, 4) == "TABLE"){ $tmp_str = odbc_result($tablelist, 3); $table_array[$i++] = $tmp_str; } } $i = count($table_array); while(--$i >= 0){ $result[$i] = odbc_exec($odbc_db, "SELECT * FROM [$table_array[$i]]"); if(!($result[$i])) die(odbc_close($odbc_db)); $source .= "<h3>$table_array[$i]</h3>\n"; $fCount = odbc_num_fields($result[$i]); for($x=1; $x<=$fCount; $x++){ $fName = odbc_field_name($result[$i], $x); $source .= "$fName<br>\n"; } $x=0; } return $source; } Greetings, Vincent PHP is my guiding light, php.net the bible...

« previous php.notes (#19578) next »