I'm trying to do if user exists function but it isn't working.My other validation works fine. addnewuser.php
<?php
include ('dbco.php');
include('users.php');
include('general.php');
$newuser = $_POST['useameinput'];
$password = md5($_POST['passwordinput']);
if (empty($errors) === true){
if (user_exists($_POST['useameinput']) === true) {
$errors[] = 'Sorry, the useame '' . $_POST['useameinput'] . '' is already taken.';
}
users.php
function user_exists($newuser) {
$newuser = sanitize($newuser);
retu (mysql_result( mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `useame` ='$newuser' "), 0) == 1) ? true : false;
}
general.php
function sanitize($data) {
retu mysql_real_escape_string($data);
}
