Hi guys.

I am an IT student currently 3 days into my work placement which is the mandatory 3rd year of my degree course. I am working for a charity in England and my first task is to transfer data from excel sheets to a microsoft sql management studio database. All well and good.

The problem I have encountered isnt with the task itself, but more setting myself up to perform it. When I was learning php in uni the last year the procedure was this:

1: Connect to filezilla
2: write php file
3: upload php file to university server
4: type relevant address into browser to view php file

I am now faced with an entirely new system and it is dawning on me that this procedure may be similar but is not the same.

The points that I need to be clarified so that I can progress are as follows:

1: The differences in connecting to microsoft sql database compared to phpmyadmin which is what I am used to. I have included this information in a php file to allow connection:

<?php
$hostname = "localhost";
$username = "myNetworkUsername";
$password = "myNetworkPassword";
$database = "testDb";
$link = mssql_connect($hostname,$username,$password);
mssql_select_db($database) or die("Unable to select database");
?>


However, since the server is hosted externally I am assuming "localhost" is incorrect?

1.After doing some googling I have included a phpinfo() function and do not see mssql mentioned anywhere. the php version is 5.3.0. This has me confused. I did not know that php was something that had to be downloaded and installed. Rather that it was a scripting language that could simply be written in a text document and away you go.

2.Google is also bringing up posts about extension=php_mssql.dll and SQLSR. I really need this terminology to be clarified.

Thanks very much , I'm pulling my hair out here, and going down endless dead ends trying to find information relevant to my dilemma.

David

Recommended Answers

All 4 Replies

Your university told you how to write php code, but they might have not told you how to configure your database and webserver.

Now here at your workplace, I think there is no role of php. Microsoft will surely give you some option to import excel data directly to you mssql server. YOu may find some utility to do such operations. For now forget about php, start googling for import excel file in MSSQL (YOUR MSSQL VERSION)

I think php will be important because the information contained in the sql database will be used to populate webpages, and php will be the method to do this.

Is there another way you could recommend? Even if there is a better way, the content in the database is still going to need to be accessed in some way

At your workplace, ask your IT department, whether they have php webserver, do they allow accessing ms sql server to that php webserver.
Instially you mentioned that you need to import excel to mssql, You did not mentioned that they are asking you to publish data on web.
to publish data you will definitely need php webserver.

Ask them can you keep data in mysql server. Because in that case you will find so many free mysql-php web server. Its difficult to find FREE mssql-php server.

The installation of PHP comes with a file called PHP.INI in which you can activate the MSSQL extension by adding extension=php_mssql.dll (or php_mssql.so if you're on *nix) to it.

You can connect to your MSSQL server by host name or IP address. The only thing that you need to worry about is that the server allows a remote connection. So the user you use to connect has to have permissions to do so. This is NOT a normal situation, due to security issues.

Apart from this, MSSQL Management Studio has an import feature that allows you to convert an Excel sheet to tables.

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.