SA-MP Forums Archive
Question. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question. (/showthread.php?tid=442846)



Question. - Sanady - 09.06.2013

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??


Re: Question. - Sascha - 09.06.2013

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.


Re: Question. - Sanady - 09.06.2013

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


Re: Question. - Ld Est Ld - 09.06.2013

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')


Re: Question. - Sascha - 09.06.2013

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.


Re: Question. - Sanady - 09.06.2013

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


Re: Question. - Sascha - 09.06.2013

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