How I can increment a letters if value already in the database? Just like in my database structure AA, AB, AC and the next value should be AD.
How to check the value and increment the value?
Database Structure
id | code |
1 | AA |
2 | AB |
3 | AC |
Example Code
<input name="maincode" value="<?php
$mysqli = new mysqli("localhost", "root", "", "2015");
$result = $mysqli->query("SELECT code FROM category
WHERE code != '' ORDER BY code");
$var = 'aa';
do {
echo $var++.'<br />';
} while ($var != 'aaa');
The next value should be AD