Jump to content

SQL Syntax Error


Ninjakreborn

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/218979-sql-syntax-error/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/218979-sql-syntax-error/#findComment-1135607
Share on other sites

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,8),

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,8),

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.

Link to comment
https://forums.phpfreaks.com/topic/218979-sql-syntax-error/#findComment-1135617
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.