<?php
include("Emp.php");
$Email = $_GET["id"];
User::FileLoader();
$content = "";
foreach (User::$userlist as $user) {
if ($user->get_Email() == $Email) {
if ($user->get_State() == 1) {
$user->set_State() = 0;
}
else if ($user->get_State() == 0) {
$user->set_State() = 1;
}
}
}
header("location:liste.php");
CodePudding user response:
The error message may be a little obtuse, but it's not that hard to understand. The return value of a function call is just that -- a value. Unlike a variable, it is not backed by persistent storage, so you cannot write to it by, for example, using it as the left-hand operand of an assignment.
Thus, both this ...
$user->set_State() = 0;
... and this ...
$user->set_State() = 1;
... are wrong.
You have not presented your User
class to inform an answer, but surely the set_State()
method expects you to specify the new state via an argument. For example,
$user->set_State(0);