estou com esse erro ao tentar efetuar um cadastro como posso resolver
Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near ','. (severity 15) in C:\wamp\www\register.php on line 163
Warning: mssql_query() [function.mssql-query]: Query failed in C:\wamp\www\register.php on line 163
usando sql 2005
$res = mssql_query($query); if($res===false) $error = "Database error. Try again"; if(strlen($error)==0){ if($site_acc_activation == 'mail'){ mail($Email,'Registration confirmation',"Follow that link to complete you registation.\n$activation_url\n"); $content_template = "register3.php"; } else{ $content_template = "register3_admin.php";
<?php session_start(); include("./common/auth.php"); include("./common/func.php"); include("./common/config.php"); $userLogin = $user->getLogin(); include("./common/page_tree.php"); $error = ""; require('./db/db_config.php'); $link=mssql_connect($database['db_host'],$database['db_login'],$database['db_password']) or die(mssql_get_last_message()); mssql_select_db($database['db_name'],$link) or die("Database unavailable"); if(isset($_GET['todo'])){ switch ($_GET['todo']) { case 'activate_user': $activation_code = $_GET['code']; $query = "select * from UserInfo where activation_code='$activation_code';"; $res = mssql_query($query); if(mssql_num_rows($res)!=1) $error = "No user with such activation code"; if(strlen($error)==0){ $fetch = mssql_fetch_assoc($res); $query = "UPDATE UserInfo SET activation_code=NULL, MailIsConfirm=1 WHERE Account='{$fetch['Account']}'"; mssql_query($query); } $brumble = '<a href="index.php">Home</a>|<a class="current" href="">Finish</a>'; $brumble_name = "Account Activation"; $content_template = "register4.php"; require_once('./common/site_options.php'); include("./templates/$site_template/index.php"); mssql_close($link); die(); break; } } require_once('./common/site_options.php'); if(!$site_allow_registration){ header("Location: index.php"); die; } if(isset($_POST['step'])) $step = $_POST['step']; else $step = 1; //if(isset($_REQUEST['step'])) $step = $_REQUEST['step']; //else $step = 1; $Account = $_POST['Account']; $Password = $_POST['Password']; $Password2 = $_POST['Password2']; $NickName = $_POST['NickName']; $FirstName = $_POST['FirstName']; $MiddleName = $_POST['MiddleName']; $LastName = $_POST['LastName']; $Email = $_POST['Email']; $Email2 = $_POST['Email2']; $Gender = $_POST['Gender']; $Birth_day = intval($_POST['Birth_day']); $Birth_month = intval($_POST['Birth_month']); $Birth_year = intval($_POST['Birth_year']); $question_id = $_POST['question_id']; $answer = $_POST['answer']; //$Date_of_birth = "$Birth_day / $Birth_month / $Birth_year"; $Date_of_birth = "$Birth_year-$Birth_month-$Birth_day"; if($step == 2){ if(empty($Account) || empty($Password) || empty($NickName) || empty($FirstName) || empty($Email) || empty($Gender) || empty($answer)) $error = "You didn't fill every fields"; //echo 'err -'.$error.'-<br/>'; if(strlen($error)==0 && $Password != $Password2) $error = "Your passwords are different"; if(strlen($error)==0 && $Email != $Email2) $error = "Your E-mails are different"; if(strlen($error)==0 && !ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", $Email)) $error = "E-mail adress failure"; if(strlen($error)==0){ $query = "SELECT * FROM UserInfo WHERE Account='$Account'"; $res = mssql_query($query); if(mssql_num_rows($res) > 0) $error = "This account name is already taken"; } if(strlen($error)==0){ $query = "SELECT * FROM UserInfo WHERE Email='$Email'"; $res = mssql_query($query); if(mssql_num_rows($res) > 0) $error = "This email is already in use"; } if(strlen($error)==0){ $query = "SELECT * FROM UserInfo WHERE NickName='$NickName'"; $res = mssql_query($query); if(mssql_num_rows($res) > 0) $error = "This Nickname is already in use"; } if(strlen($error)>0) $step = 1; } if($step == 3){ if(empty($Account) || empty($Password) || empty($NickName) || empty($FirstName) || empty($Email) || empty($Gender) || empty($answer)) $error = "hacking attempt"; $agree = $_POST['agree']; if($agree != 1) $error = "You should agree to the End User Licanse Agreement"; if(strlen($error)>0) $step = 2; } switch ($step) { case 3: $rnd_string = ''; for($i=0;$i<50;$i++) $rnd_string .= strval(rand(0,9)); $activation_code = md5($rnd_string); $activation_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?todo=activate_user&code=$activation_code"; //$sql = "insert into `user` (`name`,`surname`,`login`,`password`,`email`,`activation_code`) values ('$name','$surname','$login','$password','$email','$activation_code');"; //$res = mysql_query($sql); $Account = $_POST['Account']; $Password = $_POST['Password']; $Password2 = $_POST['Password2']; $NickName = $_POST['NickName']; $FirstName = $_POST['FirstName']; $MiddleName = $_POST['MiddleName']; $LastName = $_POST['LastName']; $Email = $_POST['Email']; $Email2 = $_POST['Email2']; $Gender = $_POST['Gender']; $Birth_day = $_POST['Birth_day']; $Birth_month = $_POST['Birth_month']; $Birth_year = $_POST['Birth_year']; $question_id = $_POST['question_id']; $answer = $_POST['answer']; $query = "INSERT INTO UserInfo ([Account] ,[Birthday] ,[Email] ,[FirstName] ,[Gender] ,[LastName] ,[MD5PassWord] ,[MiddleName] ,[NickName] ,[Right] ,[MotherLName] ,[question_id] ,[activation_code]) VALUES ('$Account' ,'$Date_of_birth' ,'$Email' ,'$FirstName' ,'$Gender' ,'$LastName' ,'".md5($Password)."' ,'$MiddleName' ,'$NickName' ,1 ,'$answer' ,$question_id ,'$activation_code')"; $res = mssql_query($query); if($res===false) $error = "Database error. Try again"; if(strlen($error)==0){ if($site_acc_activation == 'mail'){ mail($Email,'Registration confirmation',"Follow that link to complete you registation.\n$activation_url\n"); $content_template = "register3.php"; } else{ $content_template = "register3_admin.php"; } } $brumble = '<a href="index.php">Home</a>|<a class="current" href="">Finish</a>'; $brumble_name = "Account Pending Activation"; //$content_template = "register3.php"; //require_once('./common/site_options.php'); include("./templates/$site_template/index.php"); break; case 2: $Date_of_birth = "$Birth_day / $Birth_month / $Birth_year"; $brumble = '<a href="index.php">Home</a>|<a class="current" href="">Confirm</a>'; $brumble_name = "Verify Your Account Information"; $content_template = "register2.php"; //require_once('./common/site_options.php'); include("./templates/$site_template/index.php"); break; case 1: default: $query = "select * from Questions"; $question_list = mssql_query($query); $brumble = '<a href="index.php">Home</a>|<a class="current" href="">Sign Up</a>'; $brumble_name = "Account Information"; $content_template = "register.php"; //require_once('./common/site_options.php'); include("./templates/$site_template/index.php"); break; } mssql_close($link); ?>