★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/000906.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  PHP
  Help with connecting to mssql

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Help with connecting to mssql
SepodatiCreations
Member
posted April 14, 2000 12:49 AM     Click Here to See the Profile for SepodatiCreations   Click Here to Email SepodatiCreations     Edit/Delete Message Reply w/Quote
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 17

Warning: 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 13

Warning: 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

happy
Junior Member
posted April 14, 2000 03:18 AM     Click Here to See the Profile for happy     Edit/Delete Message Reply w/Quote
it seems that the picture file which has type as "ntext" cause the problem.
if you use other table ie. customers , it will work

ujludwig
Member
posted April 14, 2000 05:14 PM     Click Here to See the Profile for ujludwig   Click Here to Email ujludwig     Edit/Delete Message Reply w/Quote
If John's suggestion doesn't work...

check your php.ini file... did you uncomment that mssql extension?

extension=php3_mssql.dll

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.