嗨我有一個名爲User的類和一個名爲insertUser()的方法。致命錯誤:函數名稱必須是一個字符串.. PHP錯誤
function insertUser($first_name, $last_name, $user_name, $password, $email_address, $group_house_id)
{
$first_name = mysql_real_escape_string($first_name);
$last_name = mysql_real_escape_string($last_name);
$user_name = mysql_real_escape_string($user_name);
$password = mysql_real_escape_string($password);
$email_address = mysql_real_escape_string($email_address);
$query = "INSERT INTO Users
(FirstName,LastName,UserName,Password,EmailAddress, GroupHouseID) VALUES
('$first_name','$last_name','$user_name','$password','$email_address','$group_house_id')";
$mysql_query($query);
}
我這樣稱呼它:
$newUser = new User();
$newUser->insertUser($first_name, $last_name, $user_name, $email, $password, $group_house_id);
當我運行代碼,我得到這個錯誤:
Fatal error: Function name must be a string in /Library/WebServer/Documents/ORIOnline/includes/class_lib.php on line 33
任何人都知道我在做什麼WRONLY?另外,這是我第一次嘗試OO PHP。
乾杯,
Jonesy