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))"; 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. 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))"; 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. Link to comment https://forums.phpfreaks.com/topic/56981-solved-syntax-problem/#findComment-281499 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.