I'm having this problem where my PHP code is concatenating instead of adding
$offset=$_POST['offset']; //Get the offset
$searchLimit = 10;
$searchCount = count(sql) //For the purpose of this question, it returns the result count
Now I want to calculate the 'from' display for pagination, so I do
$from = ($offset*$searchLimit)+1;
It works fine when
$offset == 0
I get the expected result which is 1. But when
$offset == 1
It gives me 101. Basically it is concatenating the 10 and 1 to give me 101. I've tried the following
$from = (int)($offset*$searchLimit)+1
$from = ((int)($offset)*$searchLimit)+1
$from = (((int)($offset)*$searchLimit)+1)
I even tried
$offset = (int)$_POST['offset'];
But all of them are giving the same result.