sqlite
#1

I am trying to convert my mysql gmod to sqlite and I am stuck. Its not loading / inserting / updating into database. Its loading correctly I have created the table :/

http://prntscr.com/b8ujin http://prntscr.com/b8ujv3

This is selecting database:

http://prntscr.com/b8uk69

PHP код:
    if((konekcijal db_open("newrepublic.db")) == DB:0)
    {
        print(
"Nemoze da se konektira");
        
SendRconCommand("exit");
    }
    else
    {
        print(
"Uspesno se povrza so databazata!");
    } 
Its selecting it correctly http://prntscr.com/b8ukjg

This is Load and INSERT code:

PHP код:
VcitiStatsi(playerid)
{
    new 
string[500], DBResult:rezultatsoima[30]
    
format(stringsizeof(string), "SELECT * FROM `akaunti` WHERE `Ime`='%s'"ImeIgrac(playerid))
     
rezultat db_query(konekcijalstring)
    if(
db_num_rows(rezultat))
    {
         
db_get_field_assoc(rezultat"Lozinka"PlayerInfo[playerid][pLozinka], 64)
         
db_get_field_assoc(rezultat"IP"PlayerInfo[playerid][pIP], 50)
         
db_get_field_assoc(rezultat"Email"PlayerInfo[playerid][pEmail], 100)
         
db_get_field_assoc(rezultat"Panel"PlayerInfo[playerid][pPanel], 30)
          
db_get_field_assoc(rezultat"ID"soima30)
        
PlayerInfo[playerid][pID] = strval(soima)
        
db_get_field_assoc(rezultat"Admin"soima30)
        
PlayerInfo[playerid][pAdmin] = strval(soima)
        
db_get_field_assoc(rezultat"Level"soima30)
        
PlayerInfo[playerid][pLevel] = strval(soima)
        
db_get_field_assoc(rezultat"Exp"soima30)
        
PlayerInfo[playerid][pExp] = strval(soima)
        
db_get_field_assoc(rezultat"Drzava"soima30)
        
PlayerInfo[playerid][pDrzava] = strval(soima)
        
db_get_field_assoc(rezultat"Pol"soima30)
        
PlayerInfo[playerid][pPol] = strval(soima)
        
db_get_field_assoc(rezultat"Godini"soima30)
        
PlayerInfo[playerid][pGodini] = strval(soima)
          
db_get_field_assoc(rezultat"GM"soima30)
          
PlayerInfo[playerid][pGM] = strval(soima)
        
db_get_field_assoc(rezultat"Pari"soima30)
        
PlayerInfo[playerid][pPari] = strval(soima)
        
db_get_field_assoc(rezultat"Spawn"soima30)
        
PlayerInfo[playerid][pSpawn] = strval(soima)
        
db_get_field_assoc(rezultat"Skin"soima30)
        
PlayerInfo[playerid][pSkin] = strval(soima)
        
db_get_field_assoc(rezultat"Zatvor"soima30)
        
PlayerInfo[playerid][pZatvor] = strval(soima)
    }else 
Kick(playerid)
    
db_free_result(rezultat)
    
format(stringsizeof(string), "SELECT * FROM `clenovi` WHERE `Ime`='%s'"ImeIgrac(playerid))
    
rezultat db_query(konekcijalstring)
    if(
db_num_rows(rezultat) == 1)
    {
        
db_get_field_assoc(rezultat"Lider"soima30)
        new 
dalielider strval(soima)
        
db_get_field_assoc(rezultat"Mesto"soima30)
        
PlayerInfo[playerid][pClen] = strval(soima)
        
db_get_field_assoc(rezultat"Rank"soima30)
        
PlayerInfo[playerid][pRank] = strval(soima)
        if(
dalielider == 1PlayerInfo[playerid][pLider] = PlayerInfo[playerid][pClen]
    }
    
db_free_result(rezultat)
    return 
1

PHP код:
                new string[1000]
                
format(stringsizeof(string), "INSERT INTO `akaunti` (Ime, Lozinka, Email, Godini, Pol, Drzava, Pari, Skin, Level) VALUES ('%s', '%s', '%s', '%d', '%d', '%d', '%d', '7', '1')",
                  
ImeIgrac(playerid), PlayerInfo[playerid][pLozinka], PlayerInfo[playerid][pEmail], PlayerInfo[playerid][pGodini],  PlayerInfo[playerid][pPol], PlayerInfo[playerid][pDrzava], PlayerInfo[playerid][pPari])
                
db_free_result(db_query(konekcijalstring)) 
Reply
#2

Put in server.cfg
pawn Код:
db_logging 1
and you will see in logs whats wrong propably
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Put in server.cfg
pawn Код:
db_logging 1
and you will see in logs whats wrong propably
And where should that be :v
Reply
#4

Oh NVM I fixed it. It was problem with selecting DB it only checked if it will be connected :v Thanks Jeff Repped
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)