kalster Posted July 2, 2015 Share Posted July 2, 2015 I have noticed that some versions of mysql, the code below needs a ";" at the end of each line while other versions work with a "," and the end of each line. At what version of mysql did that change take place? $mySQL = "alter table users add `username` varchar(20) not null; add `location` varchar(100) not null; "; Quote Link to comment https://forums.phpfreaks.com/topic/297145-alter-table-not-working-for-some-versions-of-mysql/ Share on other sites More sharing options...
Solution requinix Posted July 2, 2015 Solution Share Posted July 2, 2015 That there is not a valid query. What was probably happening was the "username" column was added and everything after the semicolon was ignored. Use a comma. A comma. You would know that if you bothered to learn SQL. $mySQL = "alter table users add `username` varchar(20) not null, add `location` varchar(100) not null "; Quote Link to comment https://forums.phpfreaks.com/topic/297145-alter-table-not-working-for-some-versions-of-mysql/#findComment-1515433 Share on other sites More sharing options...
kalster Posted July 2, 2015 Author Share Posted July 2, 2015 Yes, you are correct, i forgot the mysql syntax. thank you. Quote Link to comment https://forums.phpfreaks.com/topic/297145-alter-table-not-working-for-some-versions-of-mysql/#findComment-1515486 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.