I have an interface implemented using angularjs, php and database is mysql and there I have a field call hop reference Ex:- 7G/0001 the 1st part is the frequency and a slash and the frequency should be the selected one from the combo box and the other part should be auto increment in the database for an example the next one could be 8G/0002. How do I implement this using angularjs, php and mysql.
Thanks
One way to do this is to store two different fields: frequency and id. Then in your queries, concatenate the values together. By using the auto increment field, you avoid any possibility of duplicate values or concurrency issues.
Example
CREATE TABLE ees.foo (
frequency VARCHAR(2) NOT NULL,
id INT AUTO_INCREMENT NOT NULL
);
Sql query
SELECT concat(frequency,'/',lpad(id, 4, '0')
FROM tbl
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.