daneth1712 Posted August 13, 2009 Share Posted August 13, 2009 Hi, We used to use a .NET and MSSQL database for our site, we are in the process of changing everything to PHP/MySQL. On our previous setup we had an ID field that would create a string like the one below for each user that completed a form and auto insert it into the database. dc2479e5-cdf1-4682-8efa-016bbf693426 Now my problem is this... I already have an auto increment field in the table, how do I ensure that this 'ID' field continues to insert this type of string onto every new entry? Any help is really appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/170157-problem-with-id-string-in-mysql/ Share on other sites More sharing options...
aschk Posted August 14, 2009 Share Posted August 14, 2009 Was that field created by MSSQL? i.e. a custom datatype? Because that's what it appears to be. If so, you will have to create a trigger (in MySQL) to generate this, or (better option) get PHP to generate an ID along the lines of what you were getting before, and insert that into the table. Quote Link to comment https://forums.phpfreaks.com/topic/170157-problem-with-id-string-in-mysql/#findComment-898072 Share on other sites More sharing options...
daneth1712 Posted August 14, 2009 Author Share Posted August 14, 2009 Hi, Thanks for your reply. Unfortunately, I have never used MSSQL and had no involvement personally in the creation of the MSSQL database, but from my understanding, yes this was a 'custom datatype'. How do I create a trigger in MySQL to generate this? Or the better option of making PHP do it? Thanks for your help so far! Quote Link to comment https://forums.phpfreaks.com/topic/170157-problem-with-id-string-in-mysql/#findComment-898161 Share on other sites More sharing options...
fenway Posted August 21, 2009 Share Posted August 21, 2009 MySQL will never figure out how to do this for you... but it's probably not far from UUID(). Quote Link to comment https://forums.phpfreaks.com/topic/170157-problem-with-id-string-in-mysql/#findComment-903196 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.