bluebyyou Posted June 24, 2007 Share Posted June 24, 2007 I am trying to create this table, but no mater what I try I keep getting syntax errors. Even when I hard code a year instead of $year I get it. I have tried changing all of my single quotes to these things ` `. I am stumped why It wont work. Can anyone see what I am doing wrong? $query2 = "CREATE TABLE '$year' ( `day` INT(11) NOT NULL AUTO_INCREMENT, `event`' DATE NOT NULL, PRIMARY KEY(day))"; Quote Link to comment https://forums.phpfreaks.com/topic/56981-solved-syntax-problem/ Share on other sites More sharing options...
bluebyyou Posted June 24, 2007 Author Share Posted June 24, 2007 I forgot to post my mysql version is 4.1.22. Quote Link to comment https://forums.phpfreaks.com/topic/56981-solved-syntax-problem/#findComment-281471 Share on other sites More sharing options...
AndyB Posted June 24, 2007 Share Posted June 24, 2007 Try this: $query2 = "CREATE TABLE ". $year. " ( day INT(11) NOT NULL AUTO_INCREMENT, event DATE NOT NULL, PRIMARY KEY(day))"; Quote Link to comment https://forums.phpfreaks.com/topic/56981-solved-syntax-problem/#findComment-281483 Share on other sites More sharing options...
bluebyyou Posted June 24, 2007 Author Share Posted June 24, 2007 Thanks, that worked. Quote Link to comment https://forums.phpfreaks.com/topic/56981-solved-syntax-problem/#findComment-281499 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.