Jump to content

Recommended Posts

The following code consistently works on all PCs tried on except my laptop.

Please give me some hints on why this may happen.

    global $dbservertype, $servername, $dbusername, $dbpassword, $dbname, $link;
    $link = mssql_connect($servername, $dbusername, $dbpassword) or die("Unable to connect to T4T database");

 

I do have the client libraries on my laptop.

I do have mssql extensions enabled in PHP.ini

and MSSQL gives no error message that I am aware of.

All I get is the "Unable to connect to T4T database" from my own code(see below) & I am aware of the die on the connect line and I have coded that many different ways but mssql refuses to share any error messages with me.

    $link = mssql_connect($servername, $dbusername, $dbpassword) or die("Unable to connect to T4T database");

    if (!(mssql_select_db($dbname, $link))) {

        echo "Error in DBConnect() = " . mssql_get_last_message();

        sprintf($Message, "At %d in %s Could not select %s at %s as %s",__LINE__, __FILE__, $dbname, $servername, $dbusername);

        trigger_error(E_USER_ERROR, $Message);

        exit;

        }

Really?

 

 

It shouldn't x.x.

 

 

Try:

 

 

or die("Error: " . mssql_get_last_message());

 

 

Maybe it's blank for some weird reason.  (If it's really blank, that will show just "Error: ".)

 

 

Hrmmmm, this might be an insulting question, but are you positive the host/username/password are correct?

 

Like, you aren't trying to use localhost or something on the laptop are you?

As you suspected adding your code and now all I get is "Error. "

host/username/password are all correct

but I do not understand your "Like, you aren't trying to use localhost or something on the laptop are you?".

If you mean am I browsing to localhost I am and the relationship between localhost and 127.0.0.1 is setup in my hosts file; did I mention that this system is on Windows.

If you mean am I using localhost in my configuration file to point to the database, yes I am.

and I am attempting to access the system(on my laptop) from my laptop.

Hrmmm I wonder if this is another infamous mssql_connect bug (which are usually caused by out dated client libraries).

 

 

If you use odbc_connect when mssql_connect isn't working, does it magically work?  If so, it's probably a client library issue.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.