[EasyDB]Creating Issue
#1

Hello !

Why it's not creating the table :/

There my settings :

PHP Code:
#define SQL_DATABASE "test" // your database name
#define SQL_SERVER "localhost" // your mysql host/server address
#define SQL_USERNAME "root" // your mysql administration access user
#define SQL_PASSWORD "" // password for the user
#include <easyDB> 
and my creating Section :

PHP Code:
    DB_INIT();
    print(
"DB Loading.....");
    
DB_CREATE_TABLE("accounts");
    
DB_StringField("name");
    
DB_StringField("salt");
    
DB_StringField("password");
    
DB_StringField("ip");
    
DB_IntField("kills");
    
DB_IntField("deaths");
    
DB_IntField("cash");
    
DB_IntField("admin");
    
DB_IntField("kicks");
    
DB_IntField("bans");
    
DB_IntField("id");
    
DB_PrimaryKey("id");
    
DB_CLOSE(); 
Any Help Please ?

Thanks in advence !
Reply
#2

I didn't added the support of creating a database with DB_INIT, you have to make the database yourself. Well i guess i'll add that in next update of easydb.

EDIT: You cannot run a query since your require a database name while connecting to mysql through mysql_connect.
Reply
#3

Quote:
Originally Posted by Gammix
View Post
I didn't added the support of creating a database with DB_INIT, you have to make the database yourself. Well i guess i'll add that in next update of easydb.
what that means ? *----->
PHP Code:
DB_CREATE_TABLE("accounts"); 
Reply
#4

"Table" not "DB", mister SA-MP Lead Scripter.
Reply
#5

LOL I have a mistake !

it's don't create table not db :3
Reply
#6

Quote:
Originally Posted by Yaa
View Post
LOL I have a mistake !

it's don't create table not db :3
You only need to create the database. DB_CREATE_TABLE does the table work.
Reply
#7

Quote:
Originally Posted by Gammix
View Post
You only need to create the database. DB_CREATE_TABLE does the table work.
That why im posting here DB_CREATE_TABLE Not working :/

Notice: Im Using MySQL R41
Reply
#8

Just remove that include and do it normally. From the looks of it, it executes multiple ALTER statements, which is just rediculous.
Reply
#9

Quote:
Originally Posted by SickAttack
View Post
Just remove that include and do it normally. From the looks of it, it executes multiple ALTER statements, which is just rediculous.
If the table isn't created, CREATE TABLE is executed only once taking care of every field mentioned in the DBIndex; Just like normal SQL query.

If the table already exist, ALTER TABLE is the only way.

I know its better to write queries and feel free to switch anytime. The major benefit you get from this is that you can shift to SQLite or MySQL anytime, you'll be able to port all the rows from MySQL to SQlite or vise versa.

@Yaa: I'll take a look into the issue and let you know.
Reply
#10

okey thank you anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)