SA-MP Forums Archive
MySQL - Connect 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: MySQL - Connect question (/showthread.php?tid=571878)



MySQL - Connect question - Adi007 - 23.04.2015

Hello all! If i upload a .db file on my samp server's host, i can use the mysql_connect function to connect to the same server where the samp server is?

like this:
new mysql = mysql_connect("Here my host ip","ftp username from my samp server","name of my .db file","password of the FTP username from my samp server");
Is correctly what i wrote? ^^


Re: MySQL - Connect question - BleverCastard - 23.04.2015

Yes. However, the IP should be "localhost". Username to connect to the database, database name & database password.


Re: MySQL - Connect question - Sithis - 23.04.2015

If your database server is on the same server as your samp server, you can use localhost. If that does not work, ask your host for the correct settings.


Re: MySQL - Connect question - Adi007 - 23.04.2015

But is correctly if i write my FTP password / username and not the SQL database username / password ?
And...what;s the difference between .db and .sql file ?


Re: MySQL - Connect question - BleverCastard - 23.04.2015

Not your FTP details. That's for your website. I'm not sure what the difference is between them. I believe .db is client-side!


Re: MySQL - Connect question - Adi007 - 23.04.2015

My last question:
Is a good idea to save players' status using .db file which is on same host with server? (in scriptfiles).
https://sampwiki.blast.hk/wiki/Db_open
I would use db_open and other function like db_.... from the link above.
Is a good idea?


Re: MySQL - Connect question - AberKane - 23.04.2015

I would rather start a MySQL server and use the MySQL database.
And for your SQLite database, make sure it's in your "scriptfile" directory.



Re: MySQL - Connect question - Adi007 - 23.04.2015

You didn't answered my question. Is good or not to use .db files with the functions like db_....from this https://sampwiki.blast.hk/wiki/Db_open


Re: MySQL - Connect question - Sithis - 23.04.2015

.db files are used with SQLite. Yes, you can open .db with db_open which is built into SA:MP.

For a SQLite database, you do NOT need a login name.


Re: MySQL - Connect question - AberKane - 23.04.2015

That question isn't supposed to be answer as good or bad.
It all depends on many factors, such as "The way you're gonna use them", "What fits your needs" and am not a pro at benchmarking and i don't know which on is better in performances, but you can use it yea. But later you might confront some difficulties and few people will be here to help you along since it's not a common way to use databases, i gave you something to use but as i've seen that's you're question and i hope someone else give a better reply.