Q: I tried mssql_connect ($ server, $ user, $ pass), and each time to connect. I know all the input Ill send him right. What is the problem with connecting to? Host machine running Windows.
Best Answer: I don't think the bit matters its their processing engine that matters and I think the code is the same regardless of version.
<?php
$host="localhost";
$username="root";
$password="";
$db_name="users";
$tbl_name="users table";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
?>
what db are you using?
Top hosting
Re:Ensure there are no firewalls blocking TCP port 1433 or UDP port 1434. If you are using custom ports, ensure all firewalls are letting traffic on these prots through and/or forwarding them to the correct host. If localhost is your true server location, make sure you don't have a software firewall blocking these ports.
If your real error message is Server not responding, it is probably a SQL Server set up issue, as opposed to a PHP problem.
Domain Name & Hosting Provider.
Re:Just went back to to writing the program. The provider hasn't gotten back to me. Here's the code I have:
<?php
$server="localhost";
$username="user";
$password="pass";
$sqlconnect=mssql_connect($server, $username, $password) or die(mssql_get_last_message()." SQL Server not responding.");
?>
The only message I get when it errors is the SQL Server not responding part. The username and password are the same ones that I use to log in VIA EMS MS SQL manager. Any other ideas?
Unlimited Web Hosting for 3.00 pounds month
Re:mysql_connect("server", "user", "password") or die(mysql_error());
should give you some sort of error. If it doesn't, try
mysql_select_db("db") or die(mysql_error());
and see what happens.
Web Hosting & Free Domain Registration
Re:I don't have access to them, I sent a message to tech support but thus far they have not been belpful at all. I tried echoing the last message from sql server but it just comes back blank.
15,000 Mb hosting for $4.95/mo
Re:Check the sql server logs, there might be a helpful error message.
How To Repair Your Sewing Machine.
Re:I can telnet to the server and it displays a black screen so I know it's accepting incoming connections. Why will it allow me to connect any way I want, except through php lol
Secrets Of Sewing Machine Repair
Re:mssql_get_last_message returns nothing… hmmm I can connect to the DB using EMS MS SQL Manager.
Cheapest Web Hosting- $7.99/Year. Host Unlimited Domains-$25.99/Year
Re:this may sound silly, but .. are you sure you have started the server?
can you connect from command line or other client?
Also, have you checked these (from the PHP documentation):
Requirements for Win32 platforms.
The extension requires the MS SQL Client Tools to be installed on the system where PHP is installed. The Client Tools can be installed from the MS SQL Server CD or by copying ntwdblib.dll from \winnt\system32 on the server to \winnt\system32 on the PHP box. Copying ntwdblib.dll will only provide access. Configuration of the client will require installation of all the tools.
The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini.
Also, have you tried printing out the server message?
I've never used mssql, but i think this might be the way to get the error message (if any)
mssql_get_last_message — Returns the last message from the server
0 Comments.