Hi there,
my table fields are.
id mobile email date.
Here mobile and email should be unique.
How to check exisitng email and existing mobile number in php.
i want to put the message separately.
this is what i done .
public function createUser($name, $email, $password, $mobile_no)
{
$response = array();
if(!$this->isUserExistscustomer($email))
{
if(!$this->isUserExistsmobile($mobile_no))
{
$password_hash = sha1($password);
$position1 = "Customer";
$rolecodeis = "2";
$comp = "Dealssante";
$today = date('Y-m-d');
$stmt1 = $this->conn->prepare("INSERT INTO customer_master(customer_name, customer_email, customer_mobileno, created_date, position) values(?, ?, ?, ?, ?)");
$stmt1->bind_param("sssss", $name, $email, $mobile_no, $today, $position1);
$result = $stmt1->execute();
$customerinsertid = $this->conn->insert_id;
$otp = mt_rand(100000, 999999);
// sms scripts will comes here
$stmt = $this->conn->prepare("INSERT INTO np_system_users(u_password, u_rolecode, person_row_id, firstname, email, mobile, company, createdat, position, onetime_password) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("sssssssssi", $password_hash, $rolecodeis, $customerinsertid, $name, $email, $mobile_no, $comp, $today, $position1, $otp);
$result1 = $stmt->execute();
if ($result == 1)
{
return USER_CREATED_SUCCESSFULLY;
}
else
{
return USER_CREATE_FAILED;
}
}
else
{
return MOBILE_EXISTED;
}
}
else
{
return USER_ALREADY_EXISTED;
}
return $response;
}