Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Guys, I am working on android app project and in this project, i need to connect my android app with PHP and MySQL everything is fine but I am getting an error in my user registration .php file error like this
Warning: mysqli_close() expects parameter 1 to be myself, null given in C:\xampp\htdocs\panel\UserRegistration.php on line 35
please help me I tried many things but the error is still there please help me thanks

What I have tried:

<?php
if($_SERVER['REQUEST_METHOD']=='POST'){

include 'DatabaseConfig.php';

$con = mysqli_connect($HostName,$HostUser,$HostPass,$DatabaseName);

$id_name = $_POST['id'];
$U_name = $_POST['username'];
$password = $_POST['password'];
$cnic = $_POST['cnic'];
$email = $_POST['email'];
$phone = $_POST['phone'];


$CheckSQL = "SELECT * FROM Users WHERE email='$email'";

$check = mysqli_fetch_array(mysqli_query($con,$CheckSQL));

if(isset($check)){

echo 'Email Already Exist';

}
else{
$Sql_Query = "INSERT INTO Users (id,username,email,password_cnic,phone) values ('$id','$U_name','$email','$password','$cnic','$phone')";

if(mysqli_query($con,$Sql_Query))
{
echo 'Registration Successfully';
}
}


?>
Posted
Updated 1-Jan-18 1:49am
Comments
ThilinaMD 1-Jan-18 10:23am    
use mysqli_close($con) to close the connection

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900