Hello I'd like to have an incremental alphanumeric key (primary key) in one of my tables. I'd like it to be BR10000, BR10001, BR10002, and so on. Any ideas? I've made some researches on google, but I find it very hard to understand for a beginner like me. So any suggestion or anything that could help get started is truly appreciated. thanks.
Store the record in your database and the primary key of that record (usually the ID column) becomes the number part. When you display it to users, you simply format it as required, e.g.:
$a = sprintf('BR%06d', 135);
var_dump($a); //string(8) "BR000135"
When you want to lookup a record from user input you simply strip off the "BR" before doing your query, e.g.:
sscanf($a, 'BR%06d', $id);
var_dump($id); //int(135)