SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 03/12/2016, 03:22 PM   #1
Yaa
Banned
 
Join Date: May 2016
Location: = GetPlayerHouse("Yaa", 0.2);
Posts: 597
Reputation: 42
Default [EasyDB]Creating Issue

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 !

Last edited by Yaa; 03/12/2016 at 04:55 PM. Reason: OMG !
Yaa is offline   Reply With Quote
Old 03/12/2016, 04:39 PM   #2
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,773
Reputation: 858
Default Re: [EasyDB]Creating Issue

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.
__________________

Follow me on Github: Donate on Paypal:

Gammix is offline   Reply With Quote
Old 03/12/2016, 04:49 PM   #3
Yaa
Banned
 
Join Date: May 2016
Location: = GetPlayerHouse("Yaa", 0.2);
Posts: 597
Reputation: 42
Default Re: [EasyDB]Creating Issue

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"); 
Yaa is offline   Reply With Quote
Old 03/12/2016, 04:53 PM   #4
iLearner
Guest
 
Posts: n/a
Default Re: [EasyDB]Creating Issue

"Table" not "DB", mister SA-MP Lead Scripter.
  Reply With Quote
Old 03/12/2016, 04:55 PM   #5
Yaa
Banned
 
Join Date: May 2016
Location: = GetPlayerHouse("Yaa", 0.2);
Posts: 597
Reputation: 42
Default Re: [EasyDB]Creating Issue

LOL I have a mistake !

it's don't create table not db :3
Yaa is offline   Reply With Quote
Old 03/12/2016, 04:58 PM   #6
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,773
Reputation: 858
Default Re: [EasyDB]Creating Issue

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.
__________________

Follow me on Github: Donate on Paypal:

Gammix is offline   Reply With Quote
Old 03/12/2016, 05:02 PM   #7
Yaa
Banned
 
Join Date: May 2016
Location: = GetPlayerHouse("Yaa", 0.2);
Posts: 597
Reputation: 42
Default Re: [EasyDB]Creating Issue

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
Yaa is offline   Reply With Quote
Old 03/12/2016, 05:55 PM   #8
SickAttack
High-roller
 
Join Date: Dec 2013
Posts: 4,761
Reputation: 754
Default Re: [EasyDB]Creating Issue

Just remove that include and do it normally. From the looks of it, it executes multiple ALTER statements, which is just rediculous.
SickAttack is offline   Reply With Quote
Old 03/12/2016, 06:08 PM   #9
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,773
Reputation: 858
Default Re: [EasyDB]Creating Issue

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.
__________________

Follow me on Github: Donate on Paypal:

Gammix is offline   Reply With Quote
Old 03/12/2016, 06:38 PM   #10
Yaa
Banned
 
Join Date: May 2016
Location: = GetPlayerHouse("Yaa", 0.2);
Posts: 597
Reputation: 42
Default Re: [EasyDB]Creating Issue

okey thank you anyway
Yaa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyDB issue Djordjekkk Scripting Help 0 10/04/2016 02:00 PM
Issue creating file Joe Staff Help Archive 6 20/04/2009 02:43 AM


All times are GMT. The time now is 05:26 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.