We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,485 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Combobox with mssql connection

I'm making a PHP script for controlling my mssql databases. But I ran into a couple of problems.

The first problem is that I want to make a combobox out of all the databases in my microsoft SQL server. The following SQL syntax gives the results that I'm looking for, but I don't know how to place it into a combobox.

SELECT name from sys.databases where owner_sid != 0x01

My next problem is, that I have to run follwing SQL command:

RESTORE FILELISTONLY FROM DISK = 'C:\Databases\Breda\backup\Backup.BAK'

But I need to get the first column of every row, and place that in 2 variables, but I don't know how to do that.

Can anyone provide me this code?

2
Contributors
2
Replies
20 Minutes
Discussion Span
2 Years Ago
Last Updated
3
Views
Xaelian
Newbie Poster
2 posts since May 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
vibhaJ
Posting Shark
958 posts since Apr 2010
Reputation Points: 161
Solved Threads: 190
Skill Endorsements: 3
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
include('adodb/adodb.inc.php');

$db = ADONewConnection(mssql_n);
$db->Connect('172.16.100.78', 'sa', 'SAPB1Admin');

$query ="SELECT name from sys.databases";
$result = @mssql_query($query);

echo "<select name='database'><option value='default'>Choose a database</option>";
while ($row=mssql_fetch_array($result))
{
$uid=$row['name'];

echo "<option value='" . $uid . "'>""</option>";
}
echo "</select>";


?>

This is the code I wrote for my combobox, but when I run it, it doesn't give any output.

Xaelian
Newbie Poster
2 posts since May 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0586 seconds using 2.68MB