0

Loading ...

UNITY PHP MYSQL DATABASE TUTORIAL

SCROLL
[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]

The following are the possible callbacks – SELECTING single data from MySQL database.

  • “Success” – User inputs and database value corresponds.
  • “Incorrect” – User password is incorrect.
  • “Unknown” – Username not available to the database.
  • “Failed” – Failed to connect to the database.
  • “Error” – User authentication is not valid.
 0)
        {
          while($row = mysqli_fetch_assoc($result))
          {
            if($row['password'] == $password)
            {
              echo("Success");
            }

            else
            {
              echo("Incorrect");
            }	
          }
        }
      
        else
        {
          echo("Unknown");
        }
      }
    
      else
      {
        echo("Failed");
      }
    }
    
    else
    {
      die("Coonection Failed.".mysql_connect_error());
      echo("Failed");
    }
  }
  
  else
  {
    echo("Error");
  }
?>

[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]

The following are the possible callbacks – INSERTING single data from MySQL database.

  • “Success” – Successfully adding inputs to the database.
  • “Existed” – Username existed from the database
  • “Failed” – Failed adding inputs to the database.
  • “Error” – User authentication is not valid.

 

[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]

The following are the possible callbacks – SELECTING single/multiple data from MySQL database.

  • “Success” – User inputs and database value corresponds.
  • “Unknown” – User inputs not available to the database.
  • “Failed” – Failed to connect to the database.
  • “Error” – User authentication is not valid.
 0) 
        {
          while($row = mysqli_fetch_assoc($result))
          {
            echo "Success:".$row['username'].":".$row['password'].":".$row['email'].":".$row['firstname'].":".$row['lastname'].":".$row['gender'].":".$row['age']."";
          }
        }
    
        else
        {
          echo("Unknown");
        }
      }
    
      else
      {
        echo("Failed");
      }
    }
    
    else
    {
      die("Coonection Failed.".mysql_connect_error());
      echo("Failed");
    }
  }
  
  else
  {
    echo("Error");
  }	
  //dns1.register.com
?>

 

[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]

The following are the possible callbacks – UPDATING single data from MySQL database.

  • “Success” – Successfully adding inputs to the database.
  • “Existed” – Username existed from the database
  • “Failed” – Failed adding inputs to the database.
  • “Error” – User authentication is not valid.
 0) 
        {
          //Insert data to the database.					
          $sqlUpdate = "UPDATE userinfo SET 
            username = '".$username."', 
            password = '".$password."', 
            email = '".$email."', 
            firstname = '".$firstname."', 
            lastname = '".$lastname."', 
            gender = '".$gender."', 
            age = '".$age."'
            WHERE identity = '".$identity."' ";
            
          $resultUpdate = mysqli_query($connection, $sqlUpdate);
          
          if($resultUpdate)
          {
            echo("Success");
          }
          
          else
          {
            echo("Failed");
          }
        }
        
        else
        {
          echo("Unknown");
        }
      }
      
      else
      {
        echo("Failed");
      }
    }
    
    else
    {
      die("Coonection Failed.".mysql_connect_error());
      echo("Failed");
    }
  }
    
  else
  {
    echo("Error");
  }	
?>

 

[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]

The following are the possible callbacks – SELECTING multiple data rows from MySQL database.

  • “Success” – User inputs and database value corresponds.
  • “Unknown” – User inputs not available to the database.
  • “Failed” – Failed to connect to the database.
  • “Error” – User authentication is not valid.
 0)
        {
          while($row = mysqli_fetch_assoc($result))
          {
            echo "\n"
            .$row['identity'].":"
            .$row['username'].":"
            .$row['password'].":"
            .$row['email'].":"
            .$row['firstname'].":"
            .$row['lastname'].":"
            .$row['gender'].":"
            .$row['age']."";
          }
        }
      
        else
        {
          echo("Unknown");
        }
      }
    
      else
      {
        echo("Failed");
      }
    }
    
    else
    {
      die("Coonection Failed.".mysql_connect_error());
      echo("Failed");
    }
  }
  
  else
  {
    echo("Error");
  }
?>

 

[siteorigin_widget class=”Thim_Heading_Widget”][/siteorigin_widget]

The following are the possible callbacks – DELETING single data from MySQL database.

  • “Success” – Successfully adding inputs to the database.
  • “Existed” – Username existed from the database
  • “Failed” – Failed adding inputs to the database.
  • “Error” – User authentication is not valid.

 

No Comments

Leave A Comment

FOLLOW US