I am trying to get a script to work to retrieve data from a MS SQL database.
I also tried using a ODBC connection, but that didn't work either.

Here is the error I get;
    Warning: MS SQL: Unable to connect to server: LocalServer in
     C:\WEBS\CTTechCouncil\stocks\mssql.php on line 7
     DATABASE FAILED TO RESPOND.

Here is what I have:

<?PHP
$hostname = "LocalServer";
$username = "ctorg";
$password = "sbc123";
$dbName = "DirectoryDB";

MSSQL_CONNECT($hostname, $username, $password) or DIE("DATABASE FAILED TO
RESPOND.");
mssql_select_db($dbName) or DIE("Table unavailable");

$query = "SELECT * FROM Company";

$result = MSSQL_QUERY($query);

$number = MSSQL_NUM_ROWS($result);

$i=0;

if ($number == 0) :
 print "No data?";
elseif ($number > 0) :
 print "Data:\n";

 while ($i < $number) :
 $name = mssql_result($result,$i,"CompanyName");
 print $name;
 print "
 ";
 $i++;
 endwhile;
endif;
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to