PHP解析错误:语法错误,意外的','in
那么,基本上我正在研究YouTube上的注册和登录教程。 这是使用旧版本的PHP,我试图更新代码,但是我得到这个错误。
解析错误:语法错误,在C: Program Files(x86) EasyPHP-DevServer-14.1VC11 data localweb projects Forum forum core functions users.php中出现意外的'
users.php
<?php
function user_exists($username, $con) {
$data = $username;
$username = sanitize($data, $con);
$username = $data;
mysqli_query($con, "SELECT `user_id` FROM `users` WHERE `username` = '$username'");
return(mysqli_affected_rows($con) == 1) ? true : false;
}
function user_active($username, $con) {
$data = $username;
$username = sanitize($data, $con);
$username = $data;
mysqli_query($con, "SELECT `user_id` FROM `users` WHERE `username` = '$username' AND `active` = 1");
return(mysqli_affected_rows($con) == 1) ? true : false;
}
function user_id_from_username ($username, $con) {
$data = $username;
$username = sanitize($data, $con);
$username = $data;
mysqli_query($con, "SELECT `user_id` FROM `users` WHERE `username` = '$username'");
return mysqli_affected_rows($con), 0, 'user_id';
}
function login($username, $password, $con) {
$user_id = user_id_from_username($username, $con);
$data = $username;
$username = sanitize($data, $con);
$username = $data;
$password = md5($password);
return (mysqli_affected_rows(mysqli_query($con, "SELECT `user_id` FROM `users` WHERE `username` = '$username' AND `password` = '$password'"), 0) == 1) ? $user_id : false;
}
?>
第23
是这一行: return mysqli_affected_rows($con), 0, 'user_id';
必须是: return mysqli_affected_rows($con) ? 0 : 'user_id';
return mysqli_affected_rows($con) ? 0 : 'user_id';
如果这是你的意思。
无法在PHP中返回多个值。
链接地址: http://www.djcxy.com/p/11935.html