Check_Username
<?php
include 'config.php';
if(isset($_POST['username'])){
$username = $_POST['username'];
// Check username
$sql = "select count(*) as allcount from users where username=$1";
$result = pg_query_params($con, $sql, array($username));
$row = pg_fetch_assoc($result);
$count = $row['allcount'];
$response = "<span style='color: green;'>Available</span>";
if($count > 0){
$response = "<span style='color: red;'>Not Available</span>";
}
echo $response;
exit;
}
usman muhammed