SQLite ( HELP )
#1

Hey,

I have a problem i have created an SQLite system for stats saving when i try to open my database via Readsql it gives an error ( An error occurred: File is not a SQLite 3 Database )
Screen:

And its not saving players data

Here's my OnFilterScriptInit:
pawn Код:
public OnFilterScriptInit()
{
   
    Database = db_open("ServerDatabase.db");
    new String[750];
    strcat(String, "CREATE TABLE IF NOT EXISTS `USERS` ", 750);
    strcat(String, "(\
                    `NAME`,\
                    `PASSWORD`,\
                    `IP`,\
                    `SCORE`,\
                    `CASH`,\
                    `ADMINLEVEL`,\
                    `KILLS`,\
                    `DEATHS`,\
                    `VIPLEVEL`,\
                    `Hours`,\
                    `Minutes`,\
                    `Seconds`,\
                    `RegisteredDate`\
                    )"
, 750);

//  strcat(String, "", 750);
   
    db_free_result(db_query(Database, DB_Escape(String)));
    return 1;
}
Please help me thanks.
Reply
#2

I'm not sure but I think you need to set type for each column:

Код:
`NAME` VARCHAR(24),\
`PASSWORD` VARCHAR(256),\
`IP` VARCHAR(16),\
`SCORE` INT,\
Reply
#3

Quote:
Originally Posted by YJIET
Посмотреть сообщение
I'm not sure but I think you need to set type for each column:

Код:
`NAME` VARCHAR(24),\
`PASSWORD` VARCHAR(256),\
`IP` VARCHAR(16),\
`SCORE` INT,\
That's not needed.
Reply
#4

Use Navicat SQLlite.
Reply
#5

I was having no problems but when i add strcat strings in OnFilterScriptInIt then it wont works.
Reply
#6

Like you had said, you had no problems before using strcat, so why use it?
  • Why do you use strcat when you know the two strings and they are less than the line limit?
  • Why do you escape the string when you know what the input is?
  • Why do you free the result when you don't select anything from the table?
  • You should check to make sure database connection was actually established
  • It's highly recommended to add the field types and maximum lengths
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)