一個成員函數CREATEUSER每當我試圖調用函數CREATEUSER()它給了我這個錯誤致命錯誤:調用上串
致命錯誤:調用一個成員函數CREATEUSER()的字符串
我真的不知道爲什麼,因爲我的其他功能都可以工作。
在那裏我調用函數的代碼:
$u = $_POST['username'];
$p = $_POST['password'];
$e = $_POST['email'];
// attempt to create user
$reg = $u->Createuser($u, $p, $e);
// if an error code is sent back, it will put it in a session.
switch ($reg)
{
case 2:
$_SESSION['err'] = 2;
break;
case 3:
$_SESSION['err'] = 3;
break;
case 10:
$_SESSION['err'] = 10;
break;
和函數本身:
function Createuser($username, $password, $email)
{
include("connection.php");
$info = mysqli_query($db2, "SELECT * FROM users WHERE username = '$username' AND password = '$password'");
// If any field is not empty
if(($username != NULL) && ($password != NULL) && ($email != NULL))
{
// If the result matches break the process
if(mysqli_num_rows($info) == 0)
{
// If rank is defined make it rank 0 else rank equels rank
if($rank == NULL)
{
$rank = 0;
}
else
{
$rank = $rank;
}
// Insert into $table
if(mysqli_query($db2, "INSERT INTO users VALUES(NULL, '$username', '$password', '$email', 0)"))
{
return 10;
}
}
else
{
// Return error code 3
return 3;
}
}
else
{
// Return error code 2
return 2;
}
}
我真的希望有人可以幫助我這個..
你是什麼由POST傳遞的價值觀?請提供您已通過的一些示例數據。 – RK12
可能的重複[參考 - 這個錯誤在PHP中意味着什麼?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – Henders
例如username = >「test」password =>「test」email =>「[email protected]」 –