I am trying to make an automatic counter to get the last id of my database. I keep rows with an alphanumeric id:
AR1, AR2, AR3, TER17, KAKAP126...
it is varchar in database so I cannot make a +1. So I want to detect the end of the chars (letters) and delete them from the id, add +1 and concat the number to the letters part.
I tried this:
$s = $rowAtt['id']; (ie: TUR99)
echo $s;
echo "<br>";
for ($i = 1; $i <= strlen($s); $i++){
$char = $a[$i-1];
if (is_numeric($char)) {
echo $char . ' is a number<br>';
} else {
echo $char . ' is a letter<br>';
}
}
But It says always "is a letter"...
What can I do for that?