Jump to content

Archived

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

aebstract

view all db info

Recommended Posts

I've never worked in microsoft sql, so I am not sure if it is in any way similar to mysql or completely different. I'm also somewhat limited on support and what I have access to. I can run php and have full ftp access. I can probably run .net as well, as the site is running on dotnetnuke and from what I've read that is based off of .net. I have no idea whatsoever how to even look at .net, so I would prefer staying with php.

 

Is there a way to use the sql server info and view all database information? I hope it is structured somewhat similar to mysql, as in having tables, columns/rows, etc. I don't know what tables I have, don't know anything really. I'm going to have to start working on a huge port out and port in to a new system (which will be mysql) and this is my first step. Any advice/info/tips is awesome. Thanks!

Share this post


Link to post
Share on other sites

Okay, I'm sort of stuck on actually displaying the information.

<?php

$server = '1';

$link = mssql_connect($server, '2', '3');

if (!$link) {
    die('Something went wrong while connecting to MSSQL');
}

$query = mssql_query("SELECT * FROM information_schema.tables");
while($r=mssql_fetch_array($query))
{

echo mssql_result($query);

}




?>

 

Blank page, I'm assuming I'm connected as I get no error and this is the method that was used as demonstration in the php manual. So that brings me to actually displaying the information, which I usually would do a while and loop through each row of information in a table, though this is obviously different and I'm not looping through like that. How can I echo out the information so I can see it?

Share this post


Link to post
Share on other sites

How about

while($r=mssql_fetch_array($query))
{

print_r($r);

}

Share this post


Link to post
Share on other sites

Isn't print_r suppose to format the array nicely so you can look at it and it make sense? Cause this is displaying like a paragraph, and there is a LOT of information. If nothing else, this at least gets me that information! Thanks

 

 

EDIT: was thinking of <pre> thanks a lot!

Share this post


Link to post
Share on other sites

This is array formatted nicely. You just have to view source to see it ;)

I used print_r only as an example. $r is an array, and you can display it however you wish. You can also save results to a file, for future reference.

Share this post


Link to post
Share on other sites

×
×
  • 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.