Jump to content

How to List the SQL server 2008 Database Tables Name using PHP


Shakir

Recommended Posts

<?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);

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.