
April 14th, 2000, 01:49 AM
|
 |
Banned (not really)
|
|
Join Date: Dec 1999
Location: Brussels, Belgium
|
|
|
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):
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<?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>";
?>
[/code]
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
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
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:Inetpubwebpubtestdatabase.php3 on line 17
Warning: MS SQL: Query failed in C:Inetpubwebpubtestdatabase.php3 on line 17
Warning: 0 is not a MS SQL result index in C:Inetpubwebpubtestdatabase.php3 on line 18
[/code]
Here is the error I get if I just use localhost:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
Warning: 0 is not a MS SQL link index in C:Inetpubwebpubtestdatabase.php3 on line 13
Warning: 0 is not a MS SQL link index in C:Inetpubwebpubtestdatabase.php3 on line 15
Warning: 0 is not a MS SQL result index in C:Inetpubwebpubtestdatabase.php3 on line 16
[/code]
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 localhostJOHNHOLM, 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
|