Following a tutorial, how would I convert this to mysqli? I found the error that it was mysql_query that wasn't supported anymore, so I already switched it to mysqli_query, but now I'm stumped on where to move on from there. How would I return that function?
function user_exists($username) {
$username = sanitize($username);
$query = mysqli_query("SELECT COUNT('user_id') FROM 'users' WHERE 'username' = '$username'");
return (mysql_result($query, 0) == 1) ? true : false; }
function user_id_from_username($username) {
$username = sanitize($username);
return mysql_result(mysql_query("SELECT 'user_id' FROM 'users' WHERE 'username' = '$username'"), 0, 'user_id'); }
Future thanks.