1

I am trying to use a binary field to show if the user has confirmed there email address . For some reason it always seems to be set at 30 , Is this normal and can you tell me why thanks.

PHP CODE

<?php 
include 'php/base.php';



$status;
//setup some variables/arrays
$action = array();
$action['result'] = null;

$firstName = $_GET['firstname'];
$lastName = $_GET['lastname'];
$email = $_GET['email'];
$password = $_GET['password'];
$password = md5($password);

$add = mysqli_query($link,"INSERT INTO `users` VALUES(NULL,'$firstName','$lastName','$password','$email',1)");



         
if($add){
    //the user was added to the database    
             
    //get the new user id
    $userid = mysqli_insert_id($link);
                 
    //create a random key
    $key = $firstName . $email . date('mY');
    $key = md5($key);
                 
    //add confirm row
    $confirm = mysqli_query($link,"INSERT INTO `confirm` VALUES(NULL,'$userid','$key','$email')"); 
                 
    if($confirm){

      include 'php/functions.php';
                 
      //let's send the email
      //include the swift class
      include_once 'lib/swift_required.php';
                   
      //put info into an array to send to the function
      $info = array(
          'fname' => $firstName,
          'email' => $email,
          'key' => $key
      );


                   
      //send the email
      if(send_email($info)){
            
        $status = "true" ;


      }else{   

        $status = "false";
      }
    }

      
  }

  echo "true";


  ?>

PHP MY ADMIN

enter image description here

enter image description here

Amy Hyland
  • 61
  • 1
  • 7

1 Answers1

0

You probably want to use BIT data type or Boolean instead.

Binary datatypes are not suited for storage of the boolean values.

Bulat
  • 6,869
  • 1
  • 29
  • 52