SA-MP Forums Archive
Whats Wrong With This... [MYSQL] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Whats Wrong With This... [MYSQL] (/showthread.php?tid=363105)



Whats Wrong With This... [MYSQL] - Littlehelper - 26.07.2012

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?


Re: Whats Wrong With This... [MYSQL] - Dan. - 26.07.2012

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 ' '.


Re: Whats Wrong With This... [MYSQL] - Littlehelper - 26.07.2012

I see.
Typo... Thanks for the help anyways.


Re: Whats Wrong With This... [MYSQL] - Vince - 26.07.2012

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.


Re: Whats Wrong With This... [MYSQL] - Misiur - 26.07.2012

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