I'm in the process of learning PHP. I've gotten to the point of having
problems with accessing a database. What is happening is that I am getting
the message "Couldn't connect to SQL Server on BOBOS" (the name of the
server). I've tried putting in a user but with the same results. Now, I'm
wondering if there is some setting in the php.ini file that I missed. I
specified in the php.ini file to use the sql server extension and it
compiles without error. Here is the code.
<?php
$myServer = "BOBOS";
$myUser = "Bobo the Bugbear";
$myPass = ""; //password not required
$myDB = "picture_DB";
$server = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
$database = @mssql_select_db($myDB)
or die("Couldn't open database $myDB");
$result = mssql_query("SELECT * FROM category",$database);
printf ("Category: %s<br>n", mssql_result($result,0,"name"));
while($row = mssql_fetch_row($result))
{
echo "<li>" . $row[0] . "</li>";
}
?>
What might I be missing? I already specified the database in the ODBC
connection part of windows. Wasn't sure if this was needed or not but did
it anyway. Anyway, if you could send me a note on what it is I might be
missing, I would greatly appreciate it.
thanks
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php