itsallbroken Posted July 27, 2009 Share Posted July 27, 2009 Hi All, My 1st post so be gentle I'm trying to use the create table query to insert a new table into an sql database, with a standard string it inserts fine but i want to be able to insert tables with a - i.e. i will be creating tables like 'TSC-SA-01' The way i have it setup is the a form is used to enter the table name, this is then assigned to a variable and the variable is called in the query, i have looked online but can't see a way of doing this? Is it possible? Thanks in Advanced G Quote Link to comment https://forums.phpfreaks.com/topic/167602-insert-into-create-table-query/ Share on other sites More sharing options...
deepson2 Posted July 27, 2009 Share Posted July 27, 2009 Welcome to the forum. I'm trying to use the create table query to insert a new table into an sql database, with a standard string it inserts fine but i want to be able to insert tables with a - i.e. i will be creating tables like 'TSC-SA-01' What you want to ask us about to create table structure or how to insert record? Quote Link to comment https://forums.phpfreaks.com/topic/167602-insert-into-create-table-query/#findComment-883803 Share on other sites More sharing options...
itsallbroken Posted July 27, 2009 Author Share Posted July 27, 2009 Creating a table in phpmyadmin i can create a table called TSC-SA-01 however when i run a query in PHP it wont let me create a table that contains the - symbol? Quote Link to comment https://forums.phpfreaks.com/topic/167602-insert-into-create-table-query/#findComment-883810 Share on other sites More sharing options...
deepson2 Posted July 27, 2009 Share Posted July 27, 2009 is that TSC-SA-01 is your table name?? Quote Link to comment https://forums.phpfreaks.com/topic/167602-insert-into-create-table-query/#findComment-883813 Share on other sites More sharing options...
Miko Posted July 27, 2009 Share Posted July 27, 2009 I don't think that you can create tables with an '-' in there name via php. Didn't test it yet, but I don't think so. with an underscore it works that for sure. Quote Link to comment https://forums.phpfreaks.com/topic/167602-insert-into-create-table-query/#findComment-883814 Share on other sites More sharing options...
itsallbroken Posted July 27, 2009 Author Share Posted July 27, 2009 is that TSC-SA-01 is your table name?? Yes Quote Link to comment https://forums.phpfreaks.com/topic/167602-insert-into-create-table-query/#findComment-883825 Share on other sites More sharing options...
deepson2 Posted July 29, 2009 Share Posted July 29, 2009 As Miko said even i think we can not use '-' in the table name. try first with simple name. and let me know what you get. Quote Link to comment https://forums.phpfreaks.com/topic/167602-insert-into-create-table-query/#findComment-885772 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.