Hugos

DB (help, please!)

Recommended Posts

How do I add data from a database? (I use the plugin mta_mysql)

Share this post


Link to post
1 hour ago, Hugos said:

How do I add data from a database? (I use the plugin mta_mysql)

 

Add data to a database?

INSERT INTO table_name (column1, column2 ) VALUES (?, ?)

 

OR

 

Get data from a database?

SELECT * FROM table_name

 

OR

 

Import data to a database from another database.

 

Edited by IIYAMA
  • Thanks 1

Share this post


Link to post
50 minutes ago, IIYAMA said:

 

Add data to a database?


INSERT INTO table_name (column1, column2 ) VALUES (?, ?)

 

OR

 

Get data from a database?


SELECT * FROM table_name

 

OR

 

Import data to a database from another database.

 

I get the player 's serial number at the moment, and if it 's not already recorded in the DB - I add.

local username = getPlayerName(source)
local serial = tostring(result_account.serial)
local u_serial = getPlayerSerial(source)

if (serial == u_serial) then --We check the serial number
else
	if (serial == "") then --number will stop. Assign a new
		INSERT INTO accounts (,  ) VALUES (?, ?)
	else
	end
end

How it is correct to make it?

Edited by Hugos

Share this post


Link to post
3 minutes ago, Hugos said:

How it is correct to make it?

Does that player already has an account?

  • Thanks 1

Share this post


Link to post
2 minutes ago, IIYAMA said:

Does that player already has an account?

Yes.  It is already registered (nikneim in recorded in "username")

Edited by Hugos

Share this post


Link to post
5 minutes ago, Hugos said:

Yes.  It is already registered (nikneim in recorded in "username")

 

Something like that:

dbExec (db, "UPDATE accounts SET serial = ? WHERE username = ?", u_serial, username)

 

  • Thanks 1

Share this post


Link to post
9 minutes ago, IIYAMA said:

 

Something like that:


dbExec (db, "UPDATE accounts SET serial = ? WHERE username = ?", u_serial, username)

 

THANKS!!!! 👊👊👊

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.