class helper
{
private $conn;
function __construct(PDO $connection)
{
$this->conn = $connection;
}
public function Dbcheck($table, $userName)
{
$sql = $this->conn->prepare("SELECT * FROM " . $table . " WHERE srilife_userName=" . $userName);
$sql->execute();
return $sql->rowCount();
}
}
$userNameCheck = $helper->Dbcheck("srilife_user", $userName);
echo $userNameCheck;