Converting mysql to mysqli.
i need help av been scratching my head how to make necessary changes but its like am making more errors.
please help or give direction what to change..
<?php
session_start();
include("php/class.user.php");
$msg = "";
$msg2 = "";
//$submit = $_POST['btnaddnew'];
if(isset($_POST['btnaddnew'])){
if(empty($_POST['txtUserId']) || empty($_POST['txtFname']) || empty($_POST['txtMname']) || empty($_POST['txtLname']) || empty($_POST['txtNoStreet']) || empty($_POST['txtCity']) || empty($_POST['txtDOB']) || empty($_POST['txtAge']) || empty($_POST['selGender']) || empty($_POST['txtUser']) || empty($_POST['txtPass']) || empty($_POST['txtConPass']) || empty($_POST['selUserType'])){
$msg = "Some field is empty!";
}else if($_POST['txtPass'] != $_POST['txtConPass']){
$msg2 = "Password did not match!";
}else{
$sqlExistId = mysql_query("select user_id from tblusers where user_id = '$_POST[txtUserId]'") or die(mysql_error());
$sqlExistUsername = mysql_query("select * from tblaccount where username = '$_POST[txtUser]'") or die(mysql_error());
if(mysql_num_rows($sqlExistId) >= 1)
$msg = "User id is already taken";
else if(mysql_num_rows($sqlExistUsername))
$msg2 = "Username is already taken!";
else{
mysql_query("insert into tblusers(user_id, fname, mname, lname, no_street, city, contact_no, dob, age, gender, user_type)
values('$_POST[txtUserId]','$_POST[txtFname]','$_POST[txtMname]','$_POST[txtLname]','$_POST[txtNoStreet]','$_POST[txtCity]','$_POST[txtContactNo]','$_POST[txtDOB]','$_POST[txtAge]','$_POST[selGender]','$_POST[selUserType]')") or die(mysql_error());
mysql_query("insert into tblaccount(user_id, username, password) values('$_POST[txtUserId]','$_POST[txtUser]','$_POST[txtPass]')") or die(mysql_error());
$msg = "Successfully added new user!";
}
}
}
?>