Hey got a big issue i need to resolve

if i have a table that records two distinct values entered by user.. NC001 OR TE001

Equipment_id | Serial | location
--------------------------------
NC001 |

if i have a php based form how can i tell it that if a user select NC or TE from a drop down box it automatically fills in the next field with

select MAX(`Equipment_ID`) FROM `asset_base` WHERE `Equipment_ID` LIKE '%NC%' +1

to increment the max NC upwards to add a new item without the user being able to overwrite the NC number..

This reeks like really bad table design.
You cannot do it dynamically in PHP in one form on one web page because PHP is a server language which does not work in the browser. You have to setup some javascript code in your page which alters the value of the NC/TE number field on change of the dropdown field.
But with that setup you're bound for trouble because you would have to lock the database for updates until the form is sent - otherwise you might end up with identical NC/TE numbers from different clients.
It's better to fill in the NC/TE number on database level in a trigger when the user data are stored and only then to display the auto-generated number to the user.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.