PHP Parse error: syntax error, unexpected ',' in

Well, basically I am working on a register and login tutorial on youtube. Which is using the old version of PHP, and I have attempted to update the code, however I get this error.

Parse error: syntax error, unexpected ',' in C:Program Files (x86)EasyPHP-DevServer-14.1VC11datalocalwebprojectsForumforumcorefunctionsusers.php on line 23

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;
}
?>

Line 23 is this one: return mysqli_affected_rows($con), 0, 'user_id';

Must be: return mysqli_affected_rows($con) ? 0 : 'user_id'; return mysqli_affected_rows($con) ? 0 : 'user_id'; if this what you meant.

Cannot return multiple values in PHP.

链接地址: http://www.djcxy.com/p/11936.html

上一篇: 解析错误:语法错误,意外的'。',期待','或';'

下一篇: PHP解析错误:语法错误,意外的','in