Why infinite cycles PHP?

require "rb/db.php";

$test = R::findOne('users', "login = ?", $array = array($_SESSION['logged_user']->login));
$books = $test->books;
$book = explode(",", $books);
$numOfBooks = R::count( 'books' );

$kol = count($book);
$i = 0;
while(i < $kol){
$rand = rand(1, $numOfBooks);
echo $rand;
if($book[i] != $rand){
$con = R::findOne('users', "login = ?", $array = array($_SESSION['logged_user']->login));
$con->books+=$rand;
R::store( $con );
}
$i++;

}
?>


Hi: login; ?>Out

Authorization
Check

}
?>
June 5th 19 at 22:00
1 answer
June 5th 19 at 22:02
In cycle no $i ++ ; instead of while(i < $kol){ need while($i < $kol){

Find more questions by tags PHP