Mysql doesn't create a table.
#1

A few days ago i started learning mysql. I have heard that mysql is fast, you can make that you could change your player stats from a website. So I decided to give it a shot and try it. Server connects to mysql, but it does not create a table. If I use ~5 variables for the table, mysql creates the table, but if I use ~27 variables, it doesn't create. I tryed using strcat, but no luck. I'm using G_Stylezz mysql plugin. Will it be necessary to create two tables in this case ?

pawn Code:
SetupTable()
{
    new query[400];
    strcat(query,"CREATE TABLE IF NOT EXISTS `"TABLENAME"`(`id` int(11) NOT NULL auto_increment PRIMARY KEY,`Vardas` varchar(30) NOT NULL,`Slaptazodis` varchar(50) NOT NULL,");
    strcat(query,"`Adminas` int(10) NOT NULL default '0',`Pagradm` int(10) NOT NULL default '0',`Meras` int(10) NOT NULL default '0',`Pinigai` int(10) NOT NULL default '0',");
    strcat(query,"`XP` int(10) NOT NULL default '0',`Darbas` int(10) NOT NULL default '0',`Persirenges` int(10) NOT NULL default '0',");
    strcat(query,"`Direktorius` int(10) NOT NULL default '0',`Uniforma` int(10) NOT NULL default '0',`Bankas` int(10) NOT NULL default '0',`Lytis` int(10) NOT NULL default '0',");
    strcat(query,"`Pakviestas` int(10) NOT NULL default '0',`MasinosTeises` int(10) NOT NULL default '0',`MotocikloTeises` int(10) NOT NULL default '0',`SunkvezimioTeises` int(10) NOT NULL default '0',`Teorija` int(10) NOT NULL default '0',`VPRegNumeris` int(10) NOT NULL default '0',");
    strcat(query,"`Surakintas` int(10) NOT NULL default '0',`Ieskomumas` int(10) NOT NULL default '0',`Alkis` int(10) NOT NULL default '0',`Irankiai` int(10) NOT NULL default '0',`Kalejimolaikas` int(10) NOT NULL default '0',`Ikalintas` int(10) NOT NULL default '0')");
    printf("Lentelės sėkmingai sukurtos.");
    return mysql_query(query);
}
Reply
#2

Check your mysql log using mysql_debug(1); on OnGameModeInit.
Reply
#3

It's generally not worth the effort to create tables via Pawn. Just create the database and the table structure in phpMyAdmin or another GUI you might have.
Reply
#4

Quote:
Originally Posted by T0pAz
View Post
Check your mysql log using mysql_debug(1); on OnGameModeInit.
Thank you very much for the mysql log

This was the error:

pawn Code:
[20:21:16] CMySQLHandler::Query(CREATE TABLE IF NOT EXISTS `zaideju_failai`(`id` int(11) NOT NULL auto_increment PRIMARY KEY,`Vardas` varchar(30) NOT NULL,`Slaptazodis` varchar(50) NOT NULL,`Adminas` int(10) NOT NULL default '0',`Pagradm` int(10) NOT NULL default '0',`Meras` int(10) NOT NULL default '0',`Pinigai` int(10) NOT NULL default '0',`XP` int(10) NOT NULL default '0',`Darbas` int(10) NOT NULL default '0',`Persirenges` i) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'i' at line 1)
I saw that the string wasn't fully printed, so i thought that the string size wasn't big enough. I changed it to 1300 and it worked! Didn't expect to be that big though...

+ rep


EDIT: + rep Vince for the idea
Reply
#5

I have to agree with Vince. Please try not to make tables via PAWN esp if it's static.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)