cant connect to sql with php using wamp
Posted by: rynokabbage (---.res.bhn.net)
Date: April 18, 2012 03:10PM

ok i downloaded wamp 2.2, has php 5.3.8 and apache 2.2.21 and i am using MSSQL 2005 for my database.
in wamp i have the php_mssql & php_pdo_mssql check and restarted all serveices.

i am using this php code to connect to, and add user names and password the the database:



##Configuration##
$mssql_server = "server name"; //MSSQL server name or IP
$mssql_username = "sa"; //MSSQL username
$mssql_password = password"; //MSSQL password
$mssql_account_db = "ACCOUNT_DBF"; //MSSQL account database name
$mssql_character_01_db = "CHARACTER_01_DBF"; //MSSQL character database name
$mssql_account_table = "account_tbl"; //MSSQL account table name
$mssql_username_column = "account"; //MSSQL username column in account table
$mssql_password_column = "password"; //MSSQL password column in account table
$hash = "hashcode"; //Hash code
$random_text_text = "rcs2105"; //Random text they must enter to register

#############################
#############################

##MSSQL Connect Function##
function mssql_connect_ini($mssql_server,$mssql_username,$mssql_password) {
$mssql_connect = mssql_connect($mssql_server, $mssql_username, $mssql_password) ----line 37
or die (" <strong>Cannot connect to the MSSQL server.</strong>"winking smiley;
if ((strlen($mssql_server) == 0) || (strlen($mssql_username) == 0) || (strlen($mssql_password) == 0)) {
echo "<strong>The connection configuration settings are invalid. Please make sure you've entered them in correctly.</strong>";
}
}

##MSSQL Account Database Select Function##
function mssql_account_ini($mssql_account_db) {
$mssql_select_db = mssql_select_db($mssql_account_db) or die ("<strong>Cannot select the Account database.</strong>"winking smiley;
if (strlen($mssql_account_db) == 0) {
echo "<strong>The account database configuration setting is invalid. Please make sure you've entered it correctly.</strong>";
}
}

#############################
#############################

##MSSQL Core Functionality##
mssql_connect_ini($mssql_server,$mssql_username,$mssql_password); ----- line 55
mssql_account_ini($mssql_account_db);

#############################
#############################

but when i try to run the php site i get the folloing errors:


( ! ) Fatal error: Call to undefined function mssql_connect() in C:\wamp\www\index.php on line 37
Call Stack
# Time Memory Function Location
1 0.0049 710976 {main}( ) ..\index.php:0
2 0.0049 712768 mssql_connect_ini( ) ..\index.php:55

the php code itself is correct and has no syntax errors.

i am new to wamp. i downloaded it because a friend said i is very nice. and i agree i just need this problem solved.

can anyone give me a step by step as to how to make the php code connect to the Sql database?

thanx i would really appreciate it.



Edited 2 time(s). Last edit at 04/18/2012 03:53PM by rynokabbage.

Options: ReplyQuote
Re: cant connect to sql with php using wamp
Posted by: stevenmartin99 (Moderator)
Date: April 18, 2012 04:13PM

Use. Sql_srv driver instead which u will need to find on the microsoft site

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: cant connect to sql with php using wamp
Posted by: rynokabbage (---.res.bhn.net)
Date: April 18, 2012 04:17PM

stevenmartin99 Wrote:
-------------------------------------------------------
> Use. Sql_srv driver instead which u will need to
> find on the microsoft site


can you tell me where to put these files? do i extract them all in wamp/bin/php/php5.3.8?? i am new to wamp sorry for the noob question



Edited 1 time(s). Last edit at 04/18/2012 06:12PM by rynokabbage.

Options: ReplyQuote
Re: cant connect to sql with php using wamp
Posted by: crambler (12.175.49.---)
Date: May 15, 2012 04:28PM

YEs can someone write up a complete walk through for making mssql work with wamp?

Options: ReplyQuote


Sorry, only registered users may post in this forum.