문제

Hi there i'm trying to convert the following function into MySQLi. I have done some but I can't figure out the rest. Can you help me?

function user_exists($username) {
$connect = mysqli_connect("host", "user", "password", "table") or die("Sorry, we are experiencing technical difficulties. Please try again later.");

$username = sanitize($username);
$query = mysqli_query($connect, "SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username'");
return (mysql_result($query, 0) == 1) ? true : false;
}
도움이 되었습니까?

해결책

You are mixing mysqli and mysql functions.you mea to use mysqli_result?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top