When people registert to my webpage i want the code to check in the msql if it already exist. now people can creat 2 users called admin, 2 users called "username" and so on. i want so when they registrate it says"Oh sorry, that usrename is in use!"
This is the code that check and post their username, passwords, email, number and so on to the mysql table.
PHP Code:
<?php
//=============Configuring Server and Database=======
$host = 'localhost';
$user = 'root';
$password = '';
//=============Data Base Information=================
$database = 'login';
$conn = mysql_connect($host,$user,$password) or die('Server Information is not Correct'); //Establish Connection with Server
mysql_select_db($database,$conn) or die('Database Information is not correct');
//===============End Server Configuration============
//============New Variable of Password is Now with an Encrypted Value========
if(isset($_POST['btnRegister'])) //===When I will Set the Button to 1 or Press Button to register
{
$query = "insert into users(rights,Rank,points,email,nummer,username,password)values('$rights','$Rank','$points','$email','$nummer','$username','$password')";
$res = mysql_query($query);
header('index.html');
}