**I have created the below registration form ** **
newuser.html
**
<form action="AddUser.php" method="POST">
<p>Enter A Username: </p>
<input type="text" name="User" maxlength="20" size="10">
<br />
<p>Enter your number: </p>
<input type="text" name="number" maxlength="40" size="10">
<br />
<input type="submit" value="Create Account">
</form>
the $_Post data is then transfered to adduser.php, the errors are within this script.. **
adduser.php
**
//grabing our $_POST data from our form and assign them to variables...
$User = $_POST['User'];
$Phone = $_POST['number'];
//Check whether user put anything in the fields for user or phone
if (!$User || !$Phone) {
echo "You have not entered all the needed info. Please try again.";
exit();
}
// database connection
$dbconnect = mysql_connect("localhost","root","");
if (!$dbconnect)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $dbconnect);
//Now inserting data into database
$sql = "INSERT INTO UsersTable (UserName, Phone)
VALUES ('".$User."', '".$Phone."')";
//Verify Successful Entry
if (mysqli_query($dbconnect,$sql)) {
echo "User Added Successfully";
} else {
echo "Error Creating User: " . mysqli_error($dbconnect);
}
echo "<br /><p>Please go to the main page to login now.</p>";
?>
and these are the error message
**> Warning: mysqli_query() expects parameter 1 to be mysqli, resource
given in C:\xampp\htdocs\test\aaa\new\adduser.php on line 28
Warning: mysqli_error() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\test\aaa\new\adduser.php on line 31 Error Creating User:**
please show me some directions to debug it.. lastly this is the login page **
login.php
**
<?php
session_start();
$User = $_POST['User'];
$PW = $_POST['Phone'];
// database connection
$dbconnect = mysql_connect("localhost","root","");
if (!$dbconnect)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $dbconnect);
//cheaking for username and Phone matches in the database
$sql = "SELECT UsersTable.UserName, UsersTable.Phone
FROM UsersTable
WHERE UsersTable.Phone = '$phone'";
$result = $dbconnect->query($sql);
$_SESSION['verified_user'] = $User; //storing it in a SESSION
}
?>
and the **
logout.php
**
<?php
session_start();
unset($_SESSION['verified_user']);
session_destroy();
echo "You are logged out.";
?>
please help me to debug the code