Checking for duplicate mysql data with bootstrap validator

Checking for duplicate mysql data with bootstrap validator

By : user2173407
Date : October 20 2020, 08:10 PM
wish help you to fix your issue I created a signup form with the bootstrap validator and connected it to a MySQL database. I wish to prevent duplicate entries by checking for existing email data and returning a message through the bootstrap validator script. I am using the remote method but the problem is as soon as I start typing in the email field, I get the "Email has already been taken." message although the email may not already exist in the database or if it is only one alphabet typed. I also get data entries even when I have not submitted the form. I have searched online and realized most of the solutions exist for the jquery validation plugin but no the bootstrap validator. I need help, please. Here is my code: , Here is the the code that worked for me:
code :
header('Content-type: application/json');

$valid = true;
$message = '';

error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);

include ("connect.php");

//get the name and comment entered by user
$fullName = $_POST['fullName'];
$userName = $_POST['userName'];
$birthday = $_POST['birthday'];
$gender = $_POST['gender'];
$email = $_POST['email'];
$password = $_POST['password'];

$fullName = mysqli_real_escape_string($con, $_POST['fullName']);
$userName = mysqli_real_escape_string($con, $_POST['userName']);
$birthday = mysqli_real_escape_string($con, $_POST['birthday']);
$email = mysqli_real_escape_string($con, $_POST['email']);
$password = mysqli_real_escape_string($con, $_POST['password']);

//insert results from the form input
$query1 = "SELECT * FROM registration where (email='$email')";
$check = mysqli_query($con, $query1);

if($checkrows > 0) {
   // If the email address exists in the table, the ``$valid`` variable define as false.
   $valid = false;
   $message = 'The email address exists.';


echo json_encode(
$valid ? array('valid' => $valid) : array('valid' => $valid, 'message' =>     $message)


Share : facebook icon twitter icon
PHP Duplicate records when checking if data was added successfully to mysql

PHP Duplicate records when checking if data was added successfully to mysql

By : Xerena Jue
Date : March 29 2020, 07:55 AM
wish of those help You are executing your query twice, that's why you have double records, simply change to this
code :
if(mysqli_query($con, $sql))
    echo "record added";
    die('Error: ' . mysqli_error($con));
Do I need duplicate object checking in each validator?

Do I need duplicate object checking in each validator?

Date : March 29 2020, 07:55 AM
this one helps. You need it so it doesn't crush when shift has not been assigned. The fact you have another validation doesn't change the fact, that it may fail.
bootstrap formvalidation.io remote validator MySQL PHP

bootstrap formvalidation.io remote validator MySQL PHP

By : Diego Paludo
Date : March 29 2020, 07:55 AM
hop of those help? i'm having some issues getting a modal form validate a username from MySQL database using PHP. , got it working like this
code :
                remote: {
                    url: '/includes/checkUser.inc.php',
                    message: {
                        en_US:  "This usenrame is already taken, please choose another one",
                        fr_FR:  "Ce nom d'utilisateur est déjà pris, 
                    data: {
                        type: 'username'
                    type: 'POST',
                    delay: 1000
How to add validation and duplicate record check w.r.t. to latest record using $.validator.addMethod bootstrap?

How to add validation and duplicate record check w.r.t. to latest record using $.validator.addMethod bootstrap?

By : Пепа Д. Христова
Date : March 29 2020, 07:55 AM
hope this fix your issue You can use remote method to check input value against database
code :
        required: true,
        region_name: true,//this is for error msg which we write in addMethod
            remote: {
            url: "check.php",
            type: "post"
messages: {
    region_name: {
        remote: "Define Remote Validation Message Here"
        required: true,
        minlength: 2 //Minimum 2 charachters required
1000hz bootstrap validator data-toggle="validator" not working

1000hz bootstrap validator data-toggle="validator" not working

By : Mehdi
Date : March 29 2020, 07:55 AM
I hope this helps you . Couple of mistakes in your approach
No jQuery lib included (must be included above all other JS libraries) bootstrap.min.js included twice (remove one) missing $ before (document).ready(function() in script missing id selector myForm in
Related Posts Related Posts :
  • Running two PHP versions on the same server (STRETCH)
  • Checking if a file has been selected for upload
  • Model not updating laravel
  • How to add a description of words from text to an array, to an array key by passing words?
  • Nginx rewrite rule not not passing variables if "/" is at the end of the url
  • Modify decimal point and thousands separator without changing the number of decimals
  • Remove PHP errors from CLI and PHPMyAdmin
  • Yii2 rest api - Url manager add parameters
  • 1-query batch update array of users using PDO
  • Keep getting error: implode(): Invalid arguments passed when updating data
  • Laravel 5.4 - Correct Validation rule for a required parameter that can be zero
  • What does this code mean: $objPHPExcel->getActiveSheet()->toArray(null, true,true,true)
  • Data not being added to mysql table but echo's the data?
  • While fetch row in PHP
  • IP long string filter
  • How to view first image in list per user as its highlight Profile
  • Insert multiple rows from array
  • PHP : How to remove a duplicate array item ONCE
  • Print the input box text as simple text instead of html tag
  • How to read a string variable in php as $_GET or $_POST?
  • MySQL query fetch array not working
  • LogicException with message '... must return a relationship instance.'
  • PHP - create new array with only selected keys from an existing array
  • How to allow backgrounding a process to survive a session termination?
  • How to redirect to Home page (Default page) in zend framework 2?
  • I want to call a jquery variable in php syntax
  • Disabling the default /?add-to-cart= animation on buttons in Woocommerce
  • How to use query data for another sql query in yii2
  • Replace string enclosed in specified characters based on data type
  • Symfony FormType: how to get prototype in form type file
  • Handle reply messages properly after some operations in php
  • PHP Changed Domain, how to remove old Session Cookies
  • mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in php
  • Error: Call to a member function update() on array laravel
  • How to change the format of a float number?
  • run ajax requests by order
  • Wordpress Install 404 Error (Cannot view login in browser)
  • Calcinai xero-php pass config once
  • Fatal error calling to undefined function in PHP file
  • Laravel hasMany and belongsTo parameters
  • How do I call a Controller method in php Laravel?
  • How to replace "@" post tag with regex in PHP?
  • Laravel : when insert record in table. How can i add that Record in the list without querying the db
  • It is possible that I could user email address to get customer id from simPRO API?
  • PHP add and merge sql result
  • laravel ckeditor dark theme
  • Laravel belongsToMany not working
  • laravel 5.4 datatables not working jquery $ referenceError
  • Zend Form 2 multiselect field is empty after validation
  • PHP - Laravel 5 get data to html table from 3 SQL database tables with column DATA as headers
  • Can't use token authorization with Laravel Passport
  • splitting lines of dates and presenting in desired format
  • Laravel 5.2 Heroku Deployment Failed to install system packages
  • Laravel relationships - are there multiple *unnecessary* database calls?
  • htaccess rewrite rule for serving index.php from parent directory
  • PHP/MongoDB - $concat aggregation
  • Remove ajax.googleapis.com from my Wordpress site
  • Image saved always empty with Storage::put in Laravel
  • How to count and sort data in junction table
  • Get common number of values in a single array
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org