Shayna  Lowe

Shayna Lowe

1659737940

Comment Créer Une Page D'inscription Avec MySQL Et PHP

Dans le site Web basé sur l'adhésion, la page d'inscription et de connexion est courante.

L'utilisateur doit créer un nouveau compte et se connecter au site Web pour accéder aux services et gérer son compte.

Dans ce tutoriel, je montre comment vous pouvez créer une page d'inscription avec MySQL et PHP.

1. Structure du tableau

J'utilise userstable dans l'exemple.

CREATE TABLE `users` (
  `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
  `fname` varchar(80) NOT NULL,
  `lname` varchar(80) NOT NULL,
  `email` varchar(80) NOT NULL,
  `password` varchar(80) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

2. Configuration

Créez un nouveau config.phpfichier pour la configuration de la base de données.

Code terminé

<?php
session_start();
$host = "localhost"; /* Host name */$user = "root"; /* User */$password = ""; /* Password */$dbname = "tutorial"; /* Database name */
$con = mysqli_connect($host, $user, $password,$dbname);
// Check connection
if (!$con) {
 die("Connection failed: " . mysqli_connect_error());
}

3.HTML & PHP

Créez un <form method='post' action='' >.

Si $error_messagen'est pas vide, affichez $error_messagela valeur à l'écran. De même, si $success_messagen'est pas vide, affichez la $success_messagevaleur à l'écran.

REMARQUE – La valeur est affectée à $error_messageet $success_messagevariable lors de la <form >soumission en fonction des conditions.

Ajoutez des champs de saisie pour la saisie - prénom, nom, e-mail, mot de passe et confirmation du mot de passe.

Ajoutez également un bouton de soumission.

Code terminé

<?php 
include "config.php";
?>
<!DOCTYPE html>
<html>
  <head>
    <title>Create Registration form with MySQL and PHP</title>

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">

    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <!-- Bootstrap JS -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>

  </head>
  <body>
    <div class='container'>
      <div class='row'>

        <div class='col-md-6' >

          <form method='post' action=''>

            <h1>SignUp</h1>
            <?php 
            // Display Error message
            if(!empty($error_message)){
            ?>
            <div class="alert alert-danger">
              <strong>Error!</strong> <?= $error_message ?>
            </div>

            <?php
            }
            ?>

            <?php 
            // Display Success message
            if(!empty($success_message)){
            ?>
            <div class="alert alert-success">
              <strong>Success!</strong> <?= $success_message ?>
            </div>

            <?php
            }
            ?>

            <div class="form-group">
              <label for="fname">First Name:</label>
              <input type="text" class="form-control" name="fname" id="fname" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="lname">Last Name:</label>
              <input type="text" class="form-control" name="lname" id="lname" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="email">Email address:</label>
              <input type="email" class="form-control" name="email" id="email" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="password">Password:</label>
              <input type="password" class="form-control" name="password" id="password" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="pwd">Confirm Password:</label>
              <input type="password" class="form-control" name="confirmpassword" id="confirmpassword" onkeyup='' required="required" maxlength="80">
            </div>

            <button type="submit" name="btnsignup" class="btn btn-default">Submit</button>
          </form>
        </div>

     </div>
    </div>
  </body>
</html>

4. Soumettre le formulaire

Ajoutez le code suivant dans la <head>section.

Lors de la <form >soumission, attribuez des $_POSTvaleurs dans les variables.

Validez les valeurs –

Pour vérifier que les valeurs d'entrée sont valides ou non, créez une $isValid = truevariable. Si une validation est falsealors attribuée falseà $isValidet l'enregistrement n'est pas inséré.

  1. Tout d'abord, vérifiez si toutes les valeurs sont saisies ou non. S'il n'est pas saisi, attribuez - falsele à $isValidet "Please fill all fields."à $error_message.
  2. Vérifiez si le mot de passe saisi et confirmez le mot de passe sont égaux ou non. S'il n'est pas égal, attribuez falseà $isValidet "Confirm password not matching."à $error_message.
  3. Vérifiez si $emailla valeur de la variable a un e-mail valide ou non. S'il n'est pas valide, attribuez - falsele à $isValidet "Invalid Email-ID."à $error_message.
  4. Vérifiez si email-id existe déjà dans la userstable ou non. Si disponible, attribuez falseà $isValidet "Email-ID is already existed."à $error_message.

Si $isValida trueune valeur, insérez un nouvel enregistrement dans la userstable et attribuez- "Account created successfully."le à $success_message.

Code terminé

<?php 
$error_message = "";$success_message = "";

// Register user
if(isset($_POST['btnsignup'])){
   $fname = trim($_POST['fname']);
   $lname = trim($_POST['lname']);
   $email = trim($_POST['email']);
   $password = trim($_POST['password']);
   $confirmpassword = trim($_POST['confirmpassword']);

   $isValid = true;

   // Check fields are empty or not
   if($fname == '' || $lname == '' || $email == '' || $password == '' || $confirmpassword == ''){
     $isValid = false;
     $error_message = "Please fill all fields.";
   }

   // Check if confirm password matching or not
   if($isValid && ($password != $confirmpassword) ){
     $isValid = false;
     $error_message = "Confirm password not matching";
   }

   // Check if Email-ID is valid or not
   if ($isValid && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
     $isValid = false;
     $error_message = "Invalid Email-ID.";
   }

   if($isValid){

     // Check if Email-ID already exists
     $stmt = $con->prepare("SELECT * FROM users WHERE email = ?");
     $stmt->bind_param("s", $email);
     $stmt->execute();
     $result = $stmt->get_result();
     $stmt->close();
     if($result->num_rows > 0){
       $isValid = false;
       $error_message = "Email-ID is already existed.";
     }

   }

   // Insert records
   if($isValid){
     $insertSQL = "INSERT INTO users(fname,lname,email,password ) values(?,?,?,?)";
     $stmt = $con->prepare($insertSQL);
     $stmt->bind_param("ssss",$fname,$lname,$email,$password);
     $stmt->execute();
     $stmt->close();

     $success_message = "Account created successfully.";
   }
}
?>

5. Démo

Voir la démo


6. Conclusion

Dans ce tutoriel, j'ai couvert le système d'enregistrement avec MySQL et PHP.

Source :  https://makitweb.com

#php #mysql 

What is GEEK

Buddha Community

Comment Créer Une Page D'inscription Avec MySQL Et PHP
Joe  Hoppe

Joe Hoppe

1595905879

Best MySQL DigitalOcean Performance – ScaleGrid vs. DigitalOcean Managed Databases

HTML to Markdown

MySQL is the all-time number one open source database in the world, and a staple in RDBMS space. DigitalOcean is quickly building its reputation as the developers cloud by providing an affordable, flexible and easy to use cloud platform for developers to work with. MySQL on DigitalOcean is a natural fit, but what’s the best way to deploy your cloud database? In this post, we are going to compare the top two providers, DigitalOcean Managed Databases for MySQL vs. ScaleGrid MySQL hosting on DigitalOcean.

At a glance – TLDR
ScaleGrid Blog - At a glance overview - 1st pointCompare Throughput
ScaleGrid averages almost 40% higher throughput over DigitalOcean for MySQL, with up to 46% higher throughput in write-intensive workloads. Read now

ScaleGrid Blog - At a glance overview - 2nd pointCompare Latency
On average, ScaleGrid achieves almost 30% lower latency over DigitalOcean for the same deployment configurations. Read now

ScaleGrid Blog - At a glance overview - 3rd pointCompare Pricing
ScaleGrid provides 30% more storage on average vs. DigitalOcean for MySQL at the same affordable price. Read now

MySQL DigitalOcean Performance Benchmark
In this benchmark, we compare equivalent plan sizes between ScaleGrid MySQL on DigitalOcean and DigitalOcean Managed Databases for MySQL. We are going to use a common, popular plan size using the below configurations for this performance benchmark:

Comparison Overview
ScaleGridDigitalOceanInstance TypeMedium: 4 vCPUsMedium: 4 vCPUsMySQL Version8.0.208.0.20RAM8GB8GBSSD140GB115GBDeployment TypeStandaloneStandaloneRegionSF03SF03SupportIncludedBusiness-level support included with account sizes over $500/monthMonthly Price$120$120

As you can see above, ScaleGrid and DigitalOcean offer the same plan configurations across this plan size, apart from SSD where ScaleGrid provides over 20% more storage for the same price.

To ensure the most accurate results in our performance tests, we run the benchmark four times for each comparison to find the average performance across throughput and latency over read-intensive workloads, balanced workloads, and write-intensive workloads.

Throughput
In this benchmark, we measure MySQL throughput in terms of queries per second (QPS) to measure our query efficiency. To quickly summarize the results, we display read-intensive, write-intensive and balanced workload averages below for 150 threads for ScaleGrid vs. DigitalOcean MySQL:

ScaleGrid MySQL vs DigitalOcean Managed Databases - Throughput Performance Graph

For the common 150 thread comparison, ScaleGrid averages almost 40% higher throughput over DigitalOcean for MySQL, with up to 46% higher throughput in write-intensive workloads.

#cloud #database #developer #digital ocean #mysql #performance #scalegrid #95th percentile latency #balanced workloads #developers cloud #digitalocean droplet #digitalocean managed databases #digitalocean performance #digitalocean pricing #higher throughput #latency benchmark #lower latency #mysql benchmark setup #mysql client threads #mysql configuration #mysql digitalocean #mysql latency #mysql on digitalocean #mysql throughput #performance benchmark #queries per second #read-intensive #scalegrid mysql #scalegrid vs. digitalocean #throughput benchmark #write-intensive

Shayna  Lowe

Shayna Lowe

1659737940

Comment Créer Une Page D'inscription Avec MySQL Et PHP

Dans le site Web basé sur l'adhésion, la page d'inscription et de connexion est courante.

L'utilisateur doit créer un nouveau compte et se connecter au site Web pour accéder aux services et gérer son compte.

Dans ce tutoriel, je montre comment vous pouvez créer une page d'inscription avec MySQL et PHP.

1. Structure du tableau

J'utilise userstable dans l'exemple.

CREATE TABLE `users` (
  `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
  `fname` varchar(80) NOT NULL,
  `lname` varchar(80) NOT NULL,
  `email` varchar(80) NOT NULL,
  `password` varchar(80) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

2. Configuration

Créez un nouveau config.phpfichier pour la configuration de la base de données.

Code terminé

<?php
session_start();
$host = "localhost"; /* Host name */$user = "root"; /* User */$password = ""; /* Password */$dbname = "tutorial"; /* Database name */
$con = mysqli_connect($host, $user, $password,$dbname);
// Check connection
if (!$con) {
 die("Connection failed: " . mysqli_connect_error());
}

3.HTML & PHP

Créez un <form method='post' action='' >.

Si $error_messagen'est pas vide, affichez $error_messagela valeur à l'écran. De même, si $success_messagen'est pas vide, affichez la $success_messagevaleur à l'écran.

REMARQUE – La valeur est affectée à $error_messageet $success_messagevariable lors de la <form >soumission en fonction des conditions.

Ajoutez des champs de saisie pour la saisie - prénom, nom, e-mail, mot de passe et confirmation du mot de passe.

Ajoutez également un bouton de soumission.

Code terminé

<?php 
include "config.php";
?>
<!DOCTYPE html>
<html>
  <head>
    <title>Create Registration form with MySQL and PHP</title>

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">

    <!-- jQuery library -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <!-- Bootstrap JS -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>

  </head>
  <body>
    <div class='container'>
      <div class='row'>

        <div class='col-md-6' >

          <form method='post' action=''>

            <h1>SignUp</h1>
            <?php 
            // Display Error message
            if(!empty($error_message)){
            ?>
            <div class="alert alert-danger">
              <strong>Error!</strong> <?= $error_message ?>
            </div>

            <?php
            }
            ?>

            <?php 
            // Display Success message
            if(!empty($success_message)){
            ?>
            <div class="alert alert-success">
              <strong>Success!</strong> <?= $success_message ?>
            </div>

            <?php
            }
            ?>

            <div class="form-group">
              <label for="fname">First Name:</label>
              <input type="text" class="form-control" name="fname" id="fname" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="lname">Last Name:</label>
              <input type="text" class="form-control" name="lname" id="lname" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="email">Email address:</label>
              <input type="email" class="form-control" name="email" id="email" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="password">Password:</label>
              <input type="password" class="form-control" name="password" id="password" required="required" maxlength="80">
            </div>
            <div class="form-group">
              <label for="pwd">Confirm Password:</label>
              <input type="password" class="form-control" name="confirmpassword" id="confirmpassword" onkeyup='' required="required" maxlength="80">
            </div>

            <button type="submit" name="btnsignup" class="btn btn-default">Submit</button>
          </form>
        </div>

     </div>
    </div>
  </body>
</html>

4. Soumettre le formulaire

Ajoutez le code suivant dans la <head>section.

Lors de la <form >soumission, attribuez des $_POSTvaleurs dans les variables.

Validez les valeurs –

Pour vérifier que les valeurs d'entrée sont valides ou non, créez une $isValid = truevariable. Si une validation est falsealors attribuée falseà $isValidet l'enregistrement n'est pas inséré.

  1. Tout d'abord, vérifiez si toutes les valeurs sont saisies ou non. S'il n'est pas saisi, attribuez - falsele à $isValidet "Please fill all fields."à $error_message.
  2. Vérifiez si le mot de passe saisi et confirmez le mot de passe sont égaux ou non. S'il n'est pas égal, attribuez falseà $isValidet "Confirm password not matching."à $error_message.
  3. Vérifiez si $emailla valeur de la variable a un e-mail valide ou non. S'il n'est pas valide, attribuez - falsele à $isValidet "Invalid Email-ID."à $error_message.
  4. Vérifiez si email-id existe déjà dans la userstable ou non. Si disponible, attribuez falseà $isValidet "Email-ID is already existed."à $error_message.

Si $isValida trueune valeur, insérez un nouvel enregistrement dans la userstable et attribuez- "Account created successfully."le à $success_message.

Code terminé

<?php 
$error_message = "";$success_message = "";

// Register user
if(isset($_POST['btnsignup'])){
   $fname = trim($_POST['fname']);
   $lname = trim($_POST['lname']);
   $email = trim($_POST['email']);
   $password = trim($_POST['password']);
   $confirmpassword = trim($_POST['confirmpassword']);

   $isValid = true;

   // Check fields are empty or not
   if($fname == '' || $lname == '' || $email == '' || $password == '' || $confirmpassword == ''){
     $isValid = false;
     $error_message = "Please fill all fields.";
   }

   // Check if confirm password matching or not
   if($isValid && ($password != $confirmpassword) ){
     $isValid = false;
     $error_message = "Confirm password not matching";
   }

   // Check if Email-ID is valid or not
   if ($isValid && !filter_var($email, FILTER_VALIDATE_EMAIL)) {
     $isValid = false;
     $error_message = "Invalid Email-ID.";
   }

   if($isValid){

     // Check if Email-ID already exists
     $stmt = $con->prepare("SELECT * FROM users WHERE email = ?");
     $stmt->bind_param("s", $email);
     $stmt->execute();
     $result = $stmt->get_result();
     $stmt->close();
     if($result->num_rows > 0){
       $isValid = false;
       $error_message = "Email-ID is already existed.";
     }

   }

   // Insert records
   if($isValid){
     $insertSQL = "INSERT INTO users(fname,lname,email,password ) values(?,?,?,?)";
     $stmt = $con->prepare($insertSQL);
     $stmt->bind_param("ssss",$fname,$lname,$email,$password);
     $stmt->execute();
     $stmt->close();

     $success_message = "Account created successfully.";
   }
}
?>

5. Démo

Voir la démo


6. Conclusion

Dans ce tutoriel, j'ai couvert le système d'enregistrement avec MySQL et PHP.

Source :  https://makitweb.com

#php #mysql 

I am Developer

1597487472

Country State City Dropdown list in PHP MySQL PHP

Here, i will show you how to populate country state city in dropdown list in php mysql using ajax.

Country State City Dropdown List in PHP using Ajax

You can use the below given steps to retrieve and display country, state and city in dropdown list in PHP MySQL database using jQuery ajax onchange:

  • Step 1: Create Country State City Table
  • Step 2: Insert Data Into Country State City Table
  • Step 3: Create DB Connection PHP File
  • Step 4: Create Html Form For Display Country, State and City Dropdown
  • Step 5: Get States by Selected Country from MySQL Database in Dropdown List using PHP script
  • Step 6: Get Cities by Selected State from MySQL Database in DropDown List using PHP script

https://www.tutsmake.com/country-state-city-database-in-mysql-php-ajax/

#country state city drop down list in php mysql #country state city database in mysql php #country state city drop down list using ajax in php #country state city drop down list using ajax in php demo #country state city drop down list using ajax php example #country state city drop down list in php mysql ajax

I am Developer

1598427973

Login Page in PHP with Database Source Code

complete login system php mysql. Here, i will show you how to build complete login system in php mysql using session.

And as well as how to create login page, user profile page in php with database and validation.

https://www.tutsmake.com/login-system-in-php-mysql-source-code-with-validation/

#login system php source code #simple login page in php with database source code #login page in php with database and validation #simple login form in php with mysql database #php login session

Asha  Beahan

Asha Beahan

1636497000

Créer Une interface De Recherche Dynamique Avec VueJS Et Php/mySql

Comment créer une interface de recherche dynamique avec VueJS et Php/mySql étape par étape

░ Fichier de base → https://github.com/JustFS/vuejs-php/archive/starting_file.zip

#vue #vuejs #mysql #php