Ninjakreborn Posted November 17, 2010 Share Posted November 17, 2010 CREATE TABLE " . $table_name4 . " ( user_id int(11) NOT NULL, rpg int(11), apg int(4), stpg int(4), bpg int(4), ppg int(4), threepg int(4), topg int(4), ft_percent int(4), ftmpg int(4), fg_percent int(4), fgapg int(4), rstd int(4), astd int(4), ststd float(10,, bstd int(3), pstd int(4), threestd int(4), tostd int(4), ftstd int(4), ftmstd int(4), fgstd int(4), mod int(4), score int(4), rank int(4) ) ENGINE=MyISAM; CREATE TABLE " . $table_name5 . " ( user_id int(11) NOT NULL, gp int(11), min int(4), fgm int(4), fga int(4), threem int(4), threea int(4), ftm int(4), fta int(4), or int(4), tr int(4), as int(4), st int(4), to int(4), bk float(10,, pf int(3), dq int(4), pts int(4), tc int(4), ej int(4), ff int(4), sta int(4), rpg int(4), apg int(4), stpg int(4), bpg int(4), ppg int(4), threepg int(4), topg float(10,, ft_percent int(3), ftmpg int(11), fg_percent int(11), fgapg int(11) ) ENGINE=MyISAM;"; I am building a wordpress plugin. The syntax on these queries seems to be wrong. I have tried manually removing them and putting them into Mysql PHPMyadmin but it still returns syntax error. Is there anything wrong with these two table creation sql scripts. Quote Link to comment https://forums.phpfreaks.com/topic/218979-sql-syntax-error/ Share on other sites More sharing options...
ManiacDan Posted November 17, 2010 Share Posted November 17, 2010 I'm sure MySQL told you what the error was. That generally helps. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/218979-sql-syntax-error/#findComment-1135605 Share on other sites More sharing options...
Pikachu2000 Posted November 17, 2010 Share Posted November 17, 2010 Fortunately for you, even without the error message, I can see the problem is that 'mod' is a MySQL reserved word, and as such you'll either need to choose a different name, or enclose it in `backticks` every time it's used in a query string. Quote Link to comment https://forums.phpfreaks.com/topic/218979-sql-syntax-error/#findComment-1135607 Share on other sites More sharing options...
PFMaBiSmAd Posted November 17, 2010 Share Posted November 17, 2010 ^^^ There's at least two more reserved keywords being used as column names (hint: they are common words that also have meaning to a query language.) Quote Link to comment https://forums.phpfreaks.com/topic/218979-sql-syntax-error/#findComment-1135609 Share on other sites More sharing options...
Ninjakreborn Posted November 17, 2010 Author Share Posted November 17, 2010 OK I got one of the queries working. Thanks, I forgot about those reserved words. however, there is one more query. CREATE TABLE " . $table_name5 . " ( user_id int(11) NOT NULL, gp int(11), min_stat int(4), fgm int(4), fga int(4), threem int(4), threea int(4), ftm int(4), fta int(4), or_stat int(4), tr int(4), as int(4), st int(4), to_stat int(4), bk float(10,, pf int(3), dq int(4), pts int(4), tc int(4), ej int(4), ff int(4), sta int(4), rpg int(4), apg int(4), stpg int(4), bpg int(4), ppg int(4), threepg int(4), topg float(10,, ft_percent int(3), ftmpg int(11), fg_percent int(11), fgapg int(11) ) ENGINE=MyISAM;"; 'I don't see anything else in this query that is a reserved word, and the code looks fine. Any more words I am missing on this one. I think I got them all, I got or and to and those were the only ones I have seen here. Quote Link to comment https://forums.phpfreaks.com/topic/218979-sql-syntax-error/#findComment-1135617 Share on other sites More sharing options...
Ninjakreborn Posted November 17, 2010 Author Share Posted November 17, 2010 OK, got it. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/218979-sql-syntax-error/#findComment-1135627 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.