Hi, I'm expert in php (I have the badge), and I know exactly what you want.
I will create a simple database and two files A and B , in the final, I will export my database and send you database and the two scripts.
I can do it in 30minutes, please accept me and I'm sure that you will be satisfied. thanks