Member Avatar for Puckdropper

Hello,

I installed PHP 5 on my Server 2003 machine with IIS and got that working properly. I want to connect to my school's MS-SQL student database, but PHP balks when it hits "mssql_connect" (or whatever the statement is). How can I set this up so I can actually connect to the database?

Apparently I need a file that's included with SQL Server (which I don't have) in order to get PHP to do this. Is there a way to get this file (nwtdb--something) so I can connect the database?

The whole motivation with this is being able to write and test the PHP code for the database without having to find times one of the labs on campus is open... they won't give users FTP access so you can't upload your files and test them from the web interface on their machine.

Member Avatar for demo

Hi

You first need the information that your school has given you to access the database...

This will include...

Database User Name
Database Password
Database Server Name
Database Server Port (#) it is listening on
Database Name you have permission to access
Database tables you have permissions to access

One you have this then you can connect using the following PHP functions

// connect $cs = mssql_connect ( 'server_name:port', 'username', 'password' ) or die ( 'Can not connect to server' ); // select mssql_select_db ( '[database_name]', $cs ) or die ( 'Can not select database' ); //query $sql = "SELECT * FROM [TABLENAME]"; $r = mssql_query ( $sql, $cs ) or die ( 'Query Error' ); // loop the result while ( $row = mssql_fetch_array ( $r ) ) { /* do stuff */ }

demo

Member Avatar for DanceInstructor

From everything I have read you have to have a copy of the MS-SQL server to get that file...

Member Avatar for Puckdropper

Thanks for the information!

Member Avatar for papa_fal

hello to all
i want connect to mssql insist of mysql ,i want design a web site with ,as default this CMS work with mysql,and how i can change setting that php read table of (sql server) insist of mysql.??? plz explain with details[i am in low level] i am wait for your responses. i hope that put this question in suitable place. thanks[php nuke],as default this CMS work with mysql,and how i can change setting that php read table of (sql server) insist of mysql.???
plz explain with details
i am wait for your responses.

i hope that put this question in suitable place.

thanks

Member Avatar for manish812

hey wht u r using to connect with mysql
i also use php in window with IIS server and using mysql but i connect it very easy.
mysql_connect("host_name","user","password")
simple hai agar koi problem ho thn mail me -----manish812@gmail.com

Member Avatar for papa_fal

hello
thanks alot of your attention.
yes,i know that mysql is better ,but my boss wants change (mysql db) to (sql server db) for (nuke[that is a CMS]).
you know that (nuke)works as default with (mysql).and i want change [connections] is special files .but i donot know where are they????and how??
do you work with nuke????and do you can help me??
i am very confused.
thanks of you .
i am wait for your response.
[plz wirte to me only to english]
with best regards.
good bye

Member Avatar for manish812

hi

sorry i don't know

i cann't help u

sorry

Member Avatar for papa_fal

hi
ok thanks,never mind.
is person that can help me??

Member Avatar for JNathanson

hi
ok thanks,never mind.
is person that can help me??

An english teacher, for a start.:-|

Member Avatar for Puckdropper

I forgot about this post, but did find the answer I was seeking.

Apparently, I did not have php.ini properly configured so PHP could find it. Therefore, it wouldn't recognize my config and the option to use the mssql database.

To fix this, I uncommented the ;extension=php_mssql.dll line in php.ini and everything was happy.

Member Avatar for papa_fal

An english teacher, for a start.:-|

i am sorry for some persons.
ya you can be my english teacher.
:lol:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.