Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to check if username already exists in php

$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$email = $_POST["email"];
$pass = $_POST["password"];

$check_email = mysqli_query($conn, "SELECT Email FROM crud where Email = '$email' ");
if(mysqli_num_rows($check_email) > 0){
    echo('Email Already exists');
}
else{
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $result = mysqli_query($conn, "INSERT INTO crud (Firstname, Lastname, Email, Password) VALUES ('$firstname', '$lastname', '$email', '$pass')");
}
    echo('Record Entered Successfully');
}
Comment

how to check user already exists in php

$sql = "SELECT username FROM table_name WHERE username='{$username}'";
$result = mysqli_query($con,$sql) or die("Query unsuccessful") ;
      if (mysqli_num_rows($result) > 0) {
        echo "Username is already exist";
      } else {
             ...............   
      }
Comment

PREVIOUS NEXT
Code Example
Php :: wordpress post types supports thumbnail 
Php :: php switch case array 
Php :: sorting sql query array by column key php 
Php :: doctrine orm get all 
Php :: laravel json response 
Php :: static function model laravel 
Php :: check for headers laravel 
Php :: laravel datepicker date format 
Php :: get_the_category() 
Php :: laravel array cache 
Php :: Adding JavaScript to a Specific WordPress Post or Page Using Code in the Footer 
Php :: loop through php array 
Php :: Laravel create foreign key column in migration 
Php :: laravel eloquent relationships count 
Php :: php artisan queue table 
Php :: - root composer.json requires php ^7.2 but your php version (8.0.1) does not satisfy that requirement. 
Php :: laravel route multiple methods 
Php :: php opendir 
Php :: not get child all data in relationship with parent laravel eloquent 
Php :: shortcode php wordpress 
Php :: for else laravel 
Php :: laravel auth check login 
Php :: php close unclosed HTML Tags 
Php :: wp main menu 
Php :: laravel query order by relation 
Php :: laravel unique validation on multiple columns 
Php :: laravel validation custom message 
Php :: find days with name between two dates in php 
Php :: php print datetime 
Php :: include() in php 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =