(ID) member
(1) 0
(2) 0
(3) 1
(4) 0
(5) 2
(6) 1
(7) 0
(8) 3
I have the table above
I have the code below in my php file.
$maxID = $dbc->prepare ('SELECT max(ID) as maxID
FROM test WHERE member > ?');
$maxID->execute([-1]);
$maxID=$maxID->fetch();
echo $maxID'['maxID];
The result of the code above is “8”.
I like to remove where clause because it has no relation with my target ID, i.e. maxID.
The below is one of my trials for it.
$maxID = $dbc->prepare ('SELECT max(ID) as maxID
FROM test');
$maxID=$maxID->fetch();
echo $maxID'['maxID];
However, my trial above produces Warning : Trying to access array offset on value of type bool.
How can I get the maxID “8” without member?