Shakir Posted October 31, 2013 Share Posted October 31, 2013 <?php //I WANT TO DISPLAY THE TABLES NAME INSIDE THE DATABASE //How to write the query for it //============================================================================== //You have to Start Session to Use the Session Variable at that page //============================================================================== session_start(); //$Server = $_SESSION['Server']; //$User = $_SESSION['User']; //$Pass = $_SESSION['Pass']; $DB = $_SESSION['DB']; echo $DB; //============================================================================== //$query = mssql_query('USE your_database SELECT name FROM sys.tables'); $query = mssql_query('USE "$DB" SELECT name FROM sys.tables'); print_r($query); Link to comment https://forums.phpfreaks.com/topic/283462-how-to-list-the-sql-server-2008-database-tables-name-using-php/ Share on other sites More sharing options...
vinny42 Posted October 31, 2013 Share Posted October 31, 2013 My first question would be: what are you working on; why do you now know the names of the tables? The code you posted makes no sense, did you read the PHP manual section about working with mssql? See: http://www.php.net/manual/en/function.mssql-query.php Link to comment https://forums.phpfreaks.com/topic/283462-how-to-list-the-sql-server-2008-database-tables-name-using-php/#findComment-1456328 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.