MySQL Create Table HELP
#1

I Maded Code, Whic Makes TABLES in SQL. But It Only Makes 'MANQANEBI's Table. Help Me To Fix.
PHP код:
public OnGameModeInit()
{
    print(
"\n----------------------------------");
    print(
"    Gamemode Awyobilia Giorgi Medzvelias Mier  ");
    print(
"         Ar Daargviot Uflebebi      ");
    print(
"       Damxmare: James Blackwood [ 3R3Kl3 ]");
    print(
"----------------------------------\n");
    
Connection mysql_connect(HostUserDBPassword);
    new 
querystr[1700];
    
strcat(querystr"CREATE TABLE IF NOT EXISTS `account`(`ID`int AUTO_INCREMENT PRIMARY KEY, `Name` varchar(24) NOT NULL, `Password` varchar(129) NOT NULL, `Email` varchar(129) NOT NULL, `Admin` int(11) NOT NULL, `Sex` int(11) NOT NULL, `Age` int(11) NOT NULL, `Level` int(11) NOT NULL, `Money` int(11) NOT NULL, `Skin` int(11) NOT NULL,");
    
strcat(querystr"`pCar` int(11) NOT NULL,`pSaxlid` int(11) NOT NULL,`pInterieri` int(11) NOT NULL,`pBankfuli` int(11) NOT NULL,`pBorbali` int(11) NOT NULL,`pSpoileri` int(11) NOT NULL,`pBamperi2` int(11) NOT NULL,`pPaintjobi` int(11) NOT NULL,`pHydrawlic` int(11) NOT NULL)"false);
    
mysql_query(Connectionquerystr);
    
mysql_query(Connection"CREATE TABLE IF NOT EXISTS `Manqanebi`(`vID`int AUTO_INCREMENT PRIMARY KEY, `Mflobeli` varchar(24) NOT NULL, `vModel` varchar(24) NOT NULL, `vFuel` int(11) NOT NULL, `PosX` int(11) NOT NULL, `PosY` int(11) NOT NULL, `PosZ` int(11) NOT NULL, `PosC` int(11) NOT NULL)"false);
    if(
mysql_errno(Connection) != 0)
    {
        print(
"Ver Vukavshirdebit SQL-s");
        }else{
        print(
"Warmatebit Davukavshirdit SQL-s");
    }
    
SetGameModeText(""Mode"");
    
SendRconCommand("hostname "Saxeli_Serveris"");
    
LoadTextDraw();
    return 
1;

Reply
#2

Help Me Guys Please Help (
Reply
#3

For some reason your strcat() wasn't working properly. I couldn't quite work out as to why so I replaced it with mysql_format. This is a very messy way of doing it, but it worked for me.

PHP код:
public OnGameModeInit() 

    print(
"\n----------------------------------"); 
    print(
"    Gamemode Awyobilia Giorgi Medzvelias Mier  "); 
    print(
"         Ar Daargviot Uflebebi      "); 
    print(
"       Damxmare: James Blackwood [ 3R3Kl3 ]"); 
    print(
"----------------------------------\n"); 
    
Connection mysql_connect(HostUserDBPassword); 
    new 
querystr1[1000], querystr2[1000], query[2000]; 
    
querystr1 "CREATE TABLE IF NOT EXISTS `account`(`ID`int AUTO_INCREMENT PRIMARY KEY, `Name` varchar(24) NOT NULL, `Password` varchar(129) NOT NULL, `Email` varchar(129) NOT NULL, `Admin` int(11) NOT NULL, `Sex` int(11) NOT NULL, `Age` int(11) NOT NULL, `Level` int(11) NOT NULL, `Money` int(11) NOT NULL, `Skin` int(11) NOT NULL,"
    
querystr2 "`pCar` int(11) NOT NULL,`pSaxlid` int(11) NOT NULL,`pInterieri` int(11) NOT NULL,`pBankfuli` int(11) NOT NULL,`pBorbali` int(11) NOT NULL,`pSpoileri` int(11) NOT NULL,`pBamperi2` int(11) NOT NULL,`pPaintjobi` int(11) NOT NULL,`pHydrawlic` int(11) NOT NULL)";
    
mysql_format(Connectionquerysizeof(query), "%s %s"querystr1querystr2);
    
mysql_query(Connectionquery); 
    
mysql_query(Connection"CREATE TABLE IF NOT EXISTS `Manqanebi`(`vID`int AUTO_INCREMENT PRIMARY KEY, `Mflobeli` varchar(24) NOT NULL, `vModel` varchar(24) NOT NULL, `vFuel` int(11) NOT NULL, `PosX` int(11) NOT NULL, `PosY` int(11) NOT NULL, `PosZ` int(11) NOT NULL, `PosC` int(11) NOT NULL)"false); 
    if(
mysql_errno(Connection) != 0
    { 
        print(
"Ver Vukavshirdebit SQL-s"); 
        }else{ 
        print(
"Warmatebit Davukavshirdit SQL-s"); 
    } 
    
SetGameModeText(""Mode""); 
    
SendRconCommand("hostname "Saxeli_Serveris""); 
    
LoadTextDraw(); 
    return 
1

Reply
#4

Creating tables within the gamemode is a waste of time, considering that the tables likely only get created once in the lifetime of the server. Rather create a database dump and use that in case the tables ever need to be recreated.
Reply
#5

god bless you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)