[EasyDB]Creating Issue -
Yaa - 03.12.2016
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 !
Re: [EasyDB]Creating Issue -
Gammix - 03.12.2016
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.
Re: [EasyDB]Creating Issue -
Yaa - 03.12.2016
Quote:
Originally Posted by Gammix
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");
Re: [EasyDB]Creating Issue - iLearner - 03.12.2016
"Table" not "DB", mister SA-MP Lead Scripter.
Re: [EasyDB]Creating Issue -
Yaa - 03.12.2016
LOL I have a mistake !
it's don't create table not db :3
Re: [EasyDB]Creating Issue -
Gammix - 03.12.2016
Quote:
Originally Posted by Yaa
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.
Re: [EasyDB]Creating Issue -
Yaa - 03.12.2016
Quote:
Originally Posted by Gammix
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
Re: [EasyDB]Creating Issue -
SickAttack - 03.12.2016
Just remove that include and do it normally. From the looks of it, it executes multiple ALTER statements, which is just rediculous.
Re: [EasyDB]Creating Issue -
Gammix - 03.12.2016
Quote:
Originally Posted by SickAttack
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.
Re: [EasyDB]Creating Issue -
Yaa - 03.12.2016
okey thank you anyway