hi all,
i want to know how to connect php with MSSQL Server.
i have installed Sql Server 2000 in my computer. i tried this function
mssql_connect but im not able to connect please help me. please
Printable View
hi all,
i want to know how to connect php with MSSQL Server.
i have installed Sql Server 2000 in my computer. i tried this function
mssql_connect but im not able to connect please help me. please
and please also tell me how can i get the USER name and password of my sql server for required parameter of mssql_connect function
If I were psychic I might be able to tell the error message you received. Unfortunatly I am not so I am afraid you are going to have to post it.Quote:
Originally Posted by chunk
If you are having problems the PHP site is a good place to start:
http://www.php.net/mssql/
visualAd,
thank you for your reply,
my problem is when i run this code
i get two error msgsCode:<?php
mssql_connect("localhost","root","");
?>
Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'root'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in C:\Program Files\EasyPHP 2.0b1\www\MSSQL\ms.php on line 4
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: localhost in C:\Program Files\EasyPHP 2.0b1\www\MSSQL\ms.php on line 4
i know why im getting this msgs because i don't know what i have to write in the Required parameter
i know my all the arguments are wrong in mssql_connect function. because i have never worked with SQL Server before thats y i want to know how can i get what should be Supplied in "USER" Argument and what should be supplied in "Password" argument and also i want to know what should be supplied in "Server" Argument.
when i move my mouse pointer to the Tray Icon of MSSQL it shows
Running - \\USER - MSSQLServer
please help me
Did you have a look at the link I sent you. More specifically: http://uk.php.net/function.mssql-connect. It tells you where to put the username and password when calling the function.
You will need to use the credentials you use to connect normally or create a special account on SQL server for PHP.
yes i have read that but i dont know the proper values of the 3 required parameters :(
can you tell me how can i get them?
If you can't read the link I posted above then I can't help you.
They are: Server - this is the name of the server where the database is. User - The login name of a user that has permissions to the database. Password - the password of the user specified in parameter 2.
Now, if you STLL don't know what to put in there.... we can't help. We didn't setup your database.... if YOU didn't... grab the person that did. You might also want to think about a class or a book on how to manage SQL Server too... if you are going to be doing any amount of database work, this is stuff you are going to come up against time and time again.
-tg
i have read that and did everything i read there but still im not able to connect because i don't know what is the USERNAME and PASSWORD of my Sql server
can you tell me how can i get the USER name of my sql server? this is the first time im using SQl server
if you think that im bothering you, you please dont waste your time in this threadCode:<?php
$h = mssql_connect(".","","");
?>
The admin account is 'sa'. However, you should create user accounts for specific purposes and grant them appropriate permissions.
This is really not a PHP topic. If you manage the SQL server then head over to the Database Development section and ask them there about setting up user accounts. If you don't manage the SQL server then ask the person who does for this information.
thanks again for being so kind to me penegate,Quote:
Originally Posted by penagate
actully one of my friend gave me SQL server 2000 CD and he told me to install it in my machine because i asked him for this.
then i installed it in my machine and i just clicked on next, next... and then finish. i did not enter any password and also i did not enter any user name while installing SQL server.
actully i want to learn how to work with SQL server And PHP instead of MySql.
i tried this code
Code:
<?php
$h = mssql_connect("local","sa","sa");
?>
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: local in C:\Program Files\EasyPHP 2.0b1\www\MSSQL\ms.php on line 4
i just want to connect to SQL server and nothing else, same thing i want to do with Oracle but not now after few days.
i really dont know what should i write in place of "LOCAL" in my above code. i have tried my computer name which is USER. you just please guide me where i can get these three parameter carefully so i can successfully connect to SQL server. if you tell me to install SQL server again then i will install it again as per your guidence
please dont get irritated,
If you jsut ran through the install w/o changing any thing, then the admin login is "sa" .. and the password is blank "". Again, I'd like to suggest a book on SQL Server. The one reason databases get hacked is because the sa account was left in it's default state (w/ no password). Even a basic book on SQL Server shoudl be able to provide a basic knowledge how it works, how to create users, and such.
-tg