posted April 14, 2000 12:49 AM
Hi. I just installed SQL Server 7.0 and I'm trying to write a simple PHP script to read some data out of the sample databases. I've fixed the php3.ini file, and that corrected the 'call to unsupported function' error I was getting.
Now, it doesn't seem to connect to the server with the mssql_connect command. Here is my code (code begins on line 8):
code:
<?php$link_id = mssql_connect("JOHNHOLM","user1","pass1");
//$link_id = mssql_connect('localhost','user1','pass1');
$db = mssql_select_db("Northwind",$link_id);
$query = mssql_query("SELECT * FROM Categories WHERE CategoryID = 1",$link_id);
$result = mssql_fetch_array($query);
echo "Category 1<hr>";
echo "Category Name: " . $result['CategoryName'] . "<br>";
echo "Description: " . $result['Description'] . "<br>";
echo "Picture: " . $result['Picture'] . "<br>";
echo "<hr>";
?>
The SQL Server box says my server name is "JOHNHOLM"I've tried various combinations of localhost and JOHNHOLM, with single and double quotes.
Here is the error I get if I just use JOHNHOLM
code:
Warning: MS SQL message: ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (severity 16) in C:\Inetpub\webpub\test\database.php3 on line 17Warning: MS SQL: Query failed in C:\Inetpub\webpub\test\database.php3 on line 17
Warning: 0 is not a MS SQL result index in C:\Inetpub\webpub\test\database.php3 on line 18
Here is the error I get if I just use localhost:
code:
Warning: 0 is not a MS SQL link index in C:\Inetpub\webpub\test\database.php3 on line 13Warning: 0 is not a MS SQL link index in C:\Inetpub\webpub\test\database.php3 on line 15
Warning: 0 is not a MS SQL result index in C:\Inetpub\webpub\test\database.php3 on line 16
I've added a login under the SQL Server Enterprise Manager, so the problem shouldn't be with the login and username, or is it? Is there difference b/t single and double quotes ?
I've tried localhost\\JOHNHOLM, but that gives me the sames errors as just using localhost.
If you know anything about this, please give me some pointers. I need to do a e-commerce page for a class i'm in and the instructor is very pro ASP, but i'd like to show everyone how easier it can be done in PHP. Only this is slowing me down...
Thanks in advance...
---John Holmes
---www.SepodatiCreations.com