Close

Registration API For Android Application

  • Home
  •  / 
  • PHP
  •  / 
  • Registration API For Android Application

Registration API For Android Application

It can help you for mobile application.

<?php
$host=”localhost”;
$pass=”password”;
$user=”user_name”;
$dbname=”dbname”;

$con=mysqli_connect($host, $user, $pass, $dbname) or die (‘connection faild’);

$response = array(“error” => FALSE);

if($_REQUEST[‘account_type’]!=”){

extract($_REQUEST);

$query=” SELECT * FROM `table_name` WHERE username=’$_REQUEST[username]'”;

$run=mysqli_query($con,$query);
$numrow = mysqli_num_rows($run);
if($numrow<1)
{

$query=”INSERT INTO `admin`(`name`, `phone_no`, `email`, `account_type`, `username`, `password`,`permission`) VALUES (‘$name’ , ‘$phone_no’ , ‘$email’ , ‘$account_type’ , ‘$username’ , ‘$pass’ , ‘$permission’)”;
$check_query=mysqli_query($con,$query);

$id = mysqli_insert_id($con);
if($id!=’0′)
{
$response[“msg”] = “Congrats Entry has been done successfully!”;
echo json_encode($response);
}
}
else
{
$response[“msg”] = “Sorry ! Username Already Registered. Please try again!”;
echo json_encode($response);
}
}

else
{
$response[“msg”] = “Sorry some issue with post value. Please try again!”;
echo json_encode($response);
}

?>

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *