Whats Wrong With This... [MYSQL]
#1

Hello,
Why this code is not creating tables?
pawn Код:
OnGamemode...
{
mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
    mysql_query("CREATE TABLE IF NOT EXIST 'playerdata' ('User' VARCHAR(24), 'Password' VARCHAR(40), 'Cash' INT(20), 'Level' INT(20), 'EXP' INT(20), 'Rank' INT(20), 'TurfsCaptured' INT(20), 'TurfsLost' INT(20), 'Kills' INT(20), 'Deaths' INT(20), 'Score' INT(20), 'Muted' INT(20), 'Warnings' INT(20), 'Vip' INT(20), 'Classes' INT(20),'IP' VARCHAR(16) )");
    mysql_debug(1);
    return 1;
}
Looks fine, whats wrong?
Reply
#2

EXISTS* not EXIST.

pawn Код:
mysql_query("CREATE TABLE IF NOT EXISTS 'playerdata' ('User' VARCHAR(24), 'Password' VARCHAR(40), 'Cash' INT(20), 'Level' INT(20), 'EXP' INT(20), 'Rank' INT(20), 'TurfsCaptured' INT(20), 'TurfsLost' INT(20), 'Kills' INT(20), 'Deaths' INT(20), 'Score' INT(20), 'Muted' INT(20), 'Warnings' INT(20), 'Vip' INT(20), 'Classes' INT(20),'IP' VARCHAR(16) )");
E:// And in my gamemode, I have " playerdata " not " 'playerdata' " So try removing ' '.
Reply
#3

I see.
Typo... Thanks for the help anyways.
Reply
#4

I consider 'create table' statements as a waste. That statement is likely going to be executed just once in the entire lifetime of the server. Not worth it. If you intend to release the script then you could simply supply a sql exported file with it.
Reply
#5

But if you insist on leaving it there, I suggest adding InnoDB engine directive (and maybe some charset settings). Are those wrappings around field names ' or `? It matters
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)