What is mysql_tablename() function in PHP?
How does mysql_tablename() works?
<?php //Attempt to connect to the default database server $link = mysql_connect("mysql_host", "mysql_user", "mysql_password")or die ("Could not connect"); //list the tables in the database $result = mysql_list_tables("my_database");//find the number of tables in database $num_rows = mysql_num_rows($result);//list the table name for ($i = 0; $i < $num_rows; $i++) {echo "Table: ", mysql_tablename($result, $i), "n"; } mysql_free_result($result); ?> |
<?php //Attempt to connect to the default database server $link = mysql_connect("mysql_host", "mysql_user", "mysql_password")or die ("Could not connect"); //list the tables in the database $result = mysql_list_tables("my_database");//query result is passed to mysql_fetch_array to fetch each row while ($row = mysql_fetch_array($result, MYSQL_NUM)) {//access result array with number index printf ("Table: %s", $row[0]);} ?> |