PDA

View Full Version : SQLite ( HELP )


Linus-
28/08/2011, 07:46 PM
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:
http://i56.tinypic.com/6yju34.png
And its not saving players data :(

Here's my OnFilterScriptInit:
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.

Stylock
28/08/2011, 08:13 PM
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,\

FireCat
28/08/2011, 08:14 PM
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.

PrawkC
28/08/2011, 08:48 PM
Use Navicat SQLlite.

Linus-
29/08/2011, 04:26 AM
I was having no problems but when i add strcat strings in OnFilterScriptInIt then it wont works.

Bakr
29/08/2011, 04:35 AM
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