Software

UNITY PHP MYSQL DATABASE TUTORIAL

UNITY PHP MYSQL DATABASE TUTORIAL

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.
  1. {
      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"); } ?>

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.

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.
  1. {
      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 ?>

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.
  1. {
      //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"); } ?>

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.
  1. {
      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"); } ?>

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.

Empowering Businesses with Customized Software Solutions

Tell us what you need — we typically reply within the day. Let’s build something that drives your business forward.