|
-
Oct 1st, 2008, 01:01 PM
#1
Thread Starter
Fanatic Member
PHP With SQL Server
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
-
Oct 1st, 2008, 01:03 PM
#2
Thread Starter
Fanatic Member
Re: PHP With SQL Server
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
-
Oct 1st, 2008, 04:49 PM
#3
Re: PHP With SQL Server
 Originally Posted by chunk
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
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.
If you are having problems the PHP site is a good place to start:
http://www.php.net/mssql/
-
Oct 1st, 2008, 10:47 PM
#4
Thread Starter
Fanatic Member
Re: PHP With SQL Server
visualAd,
thank you for your reply,
my problem is when i run this code
Code:
<?php
mssql_connect("localhost","root","");
?>
i get two error msgs
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
-
Oct 2nd, 2008, 01:32 AM
#5
Re: PHP With SQL Server
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.
-
Oct 2nd, 2008, 02:08 AM
#6
Thread Starter
Fanatic Member
Re: PHP With SQL Server
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?
-
Oct 2nd, 2008, 09:29 AM
#7
Re: PHP With SQL Server
If you can't read the link I posted above then I can't help you.
-
Oct 2nd, 2008, 11:35 AM
#8
Re: PHP With SQL Server
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
-
Oct 2nd, 2008, 02:16 PM
#9
Thread Starter
Fanatic Member
Re: PHP With SQL Server
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
Code:
<?php
$h = mssql_connect(".","","");
?>
if you think that im bothering you, you please dont waste your time in this thread
-
Oct 2nd, 2008, 10:34 PM
#10
Re: PHP With SQL Server
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.
-
Oct 3rd, 2008, 12:55 PM
#11
Thread Starter
Fanatic Member
Re: PHP With SQL Server
 Originally Posted by penagate
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,
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,
-
Oct 3rd, 2008, 01:14 PM
#12
Re: PHP With SQL Server
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|