I'm new to php. I've some problem. I get the value of username with ($_GET) variable. Let's suppose if some one enter (mehwish) in url. I want to check if the username entered by user is available or not in the database. My code below doesn't work. Correct my mistake if there's any. Thank you for your support.
<?php include("header.php");
include("classes/db.php");
session_start();
$username="";
if(isset($_GET['username']))
{
$user=$_GET['username'];
if("SELECT user_name FROM user_reg WHERE user_name='$user'")
{
$username="SELECT user_name FROM user_reg WHERE user_name='$user'";
$run_username=mysqli_query($con,$username);
$row=mysqli_fetch_array($run_username);
$username=$row['user_name'];
}
else
{
die("User does nto exist");
}
}
?>