Question.
#1

Hello everybody.I am thinking to make my own Ban system which will be based on MySQL.But for MySQL I am planing to make new table and there to insert bans.But how to connect two tables same time??
Reply
#2

Try to add two "mysql_connect" lines with 2 different tables... and use a MySQL variable like
Код:
new MySQL:connection1, MySQL:connection2;
on the top of your script, so you can later differentiate them when e.g. disconnecting....
In the mysql query you need to add the current table you want to address in the code... For the exact useage of that mysql code you might need to ******, I'm not quite sure how it looks anymore, although I know that there is a certain way to code the query for such cases...
I guess it should work with SA-MP, too.
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
Try to add two "mysql_connect" lines with 2 different tables... and use a MySQL variable like
Код:
new MySQL:connection1, MySQL:connection2;
on the top of your script, so you can later differentiate them when e.g. disconnecting....
In the mysql query you need to add the current table you want to address in the code... For the exact useage of that mysql code you might need to ******, I'm not quite sure how it looks anymore, although I know that there is a certain way to code the query for such cases...
I guess it should work with SA-MP, too.
Thank you
Reply
#4

You don't need to connect to table. Only (hostname, user, passwrod, database)
The database, what you need and there are the tables.

You only need to know some MySQL commands. I assume you've aleady made tabvle "bans"

INSERT INTO bans (playerName, playerIP) VALUES ('Ld Est Ld', '127.0.0.1')
Reply
#5

I've checked my old IT stuff and found the coding I mentioned above...
you can use something like that in the query:
Код:
SELECT `bans.username`, `user.rank` FROM `bans`, `user`
.. so the thing infront of the dot is the table name and the thing after the dot (username and rank) is the acutal field you want to check...
Hope that saves you some time, and you get what you need out of it ...
@Ld Est Ld: sometimes it better to have different tables.
Reply
#6

Quote:
Originally Posted by Sascha
Посмотреть сообщение
I've checked my old IT stuff and found the coding I mentioned above...
you can use something like that in the query:
Код:
SELECT `bans.username`, `user.rank` FROM `bans`, `user`
.. so the thing infront of the dot is the table name and the thing after the dot (username and rank) is the acutal field you want to check...
Hope that saves you some time, and you get what you need out of it ...
@Ld Est Ld: sometimes it better to have different tables.
Aha it`s not hard thanks
Reply
#7

and for my first answer... you really just need 1 mysql_connect with the db name.. I first thought you wanted to connect to different databases and not different tables -.-.... the rest was correct though
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)