View Full Version : php + mssql help :)

05-31-2015, 12:30 PM
hey guys... iam gettin undiffine connection sql...can you help please...



if($_POST['regpassword'] == $_POST['regcpassword']){
if(!empty($_POST['regusername']) && !empty($_POST['regpassword'])) {

$con=mysql_connect('AMIR-PC\SQLEXPRESS','sa','FD9D60B133f498b') or die(mysql_error());
mysql_select_db('dnmembership') or die("cannot select DB");

$query=mysql_query("SELECT * FROM Accounts WHERE AccountName='".$user."'");
$sql="INSERT INTO Accounts(AccountName,NxLoginPwd,AccountEmail) VALUES('$user','$pass','$email')";


echo "Account Successfully Created";
} else {
echo "Failure!";

} else {
echo "That username already exists! Please try again with another.";

} else {
echo "All fields are required!";
echo "passwords are not match";


register form:

<form action="" method="post" id="register-form" novalidate>
<div class="register-body">
<input name="regusername" type="text" class="type4"/>
<input name="regpassword" id="regpassword" type="password" class="type4"/>
<br/>Confirm Password<br/>
<input name="regcpassword" type="password" class="type4"/>
<br/>E-Mail Address<br/>
<input name="regemail" type="text" class="type4"/>
<br/>Security Image<br/>
<input name="regcaptcha" type="text" class="type4" maxlength="5"/>
<table width="338" border="0" cellspacing="0" cellpadding="0" style="margin-top:10px;">
<td><img src="includes/captcha502b.png?_CAPTCHA&amp;t=0.43569700+1428219637" alt="CAPTCHA"/></td>
<td valign="top" align="center">
<div class="input type2 type4" style="display: inline-block">
<input name="submit" type="submit" value="SUBMIT" class="button" id="submit"/>
<div class="hover"></div>
<div class="input type2 type3 type4" style="display: inline-block">
<input name="reset" type="reset" value="RESET ALL" class="button" id="reset"/>
<div class="hover"></div>

btw...its not for world of warcraft server

05-31-2015, 02:45 PM
What exactly is it that you are trying to do? more details please

05-31-2015, 04:30 PM
use Mysqli, mysql is depreciated.

mysqli_connect(host, user, pass, db);

and 'AMIR-PC\SQLEXPRESS' isn't a hostname. if it is local then just use localhost or

05-31-2015, 04:36 PM
He cannot use mysqli. He use mssql. Not mysql. That's different. I tried to help him myself but i could not help since he use mssql

05-31-2015, 06:23 PM
So he is running a sql server?

AS mssql stands for Microsoft Structured Query Language
And that is from Microsoft SQL Server

He's into some pretty advanced stuff here, Nothing i can really do as that is a bit more advanced for my current skills. but i thought i would share it.

05-31-2015, 07:44 PM
This should help you: http://php.net/manual/en/function.mssql-connect.php

mssql_connect($server, 'sa', 'phpfi');