Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: MEGAMIND on Jul 08, 2018, 07:32 AM

Title: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 07:32 AM
like the topic says is there anyway to connect through web to server db?
Title: Re: Coonect php to server DB
Post by: DizzasTeR on Jul 08, 2018, 07:45 AM
Yes by using PHP functions ofcourse.
Title: Re: Coonect php to server DB
Post by: EK.IceFlake on Jul 08, 2018, 08:33 AM
Yes. https://secure.php.net/manual/en/book.mysqli.php
Title: Re: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 09:16 AM
ive been using PHP  alot for search engines etc etc but never figured out how to connect it to vcmp server db

is there any snippet like thing for it
Title: Re: Coonect php to server DB
Post by: ! on Jul 08, 2018, 10:57 AM
Quote from: MEGAMIND on Jul 08, 2018, 09:16 AMive been using PHP  alot for search engines etc etc but never figured out how to connect it to vcmp server db

is there any snippet like thing for it
This link contains complete information of creating a connection to MySQL database using php
https://secure.php.net/manual/en/mysqli.quickstart.connections.php

$mysqli = new mysqli("localhost", "user", "password", "database");


You said you wants to connect to server database using php. Is it MySQL? Because the above will allow you to connect to MySQL database not SQL.
Title: Re: Conect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 01:10 PM
i have database as .db how is this suppose to help me ? ive tried it but the console says check that ur connection details r okay..so yes they are alright mysql_hostname <- "localhost";
mysql_database <- "Files/DataBase.db";
mysql_username <- "myname";
mysql_password <- "hisname";

function onScriptLoad()
{
   mysqlDB <- mysql_connect( mysql_hostname, mysql_username, mysql_password, mysql_database);
   if( mysqlDB ) print( "[SERVER] Connection to mySQL database successful." );
   else print( "[SERVER] Connection to mySQL failed." );
}


normally i use this to connect to my database when coding shitsdb <- ConnectSQL( "Files/DataBase.db" ); so any refrence guyys?

Error :
(https://i.imgur.com/UdSSV2K.jpg)

Plugins list :
(https://i.imgur.com/jExstl2.jpg)

+ Dont tell me to update my every damn thing is updated ;P

if u say i need some other party software too so yea i have it running its xampp

+ i already read some stuff from here too https://forum.vc-mp.org/?topic=444.msg2971#msg2971 although i dont need it cuz been coding with php from idk months/maybe 2-3 years but never connected a game so yea its my first time and its been tough
Title: Re: Coonect php to server DB
Post by: Xmair on Jul 08, 2018, 01:29 PM
You need to make a mysql account.
Title: Re: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 01:39 PM
Quote from: Xmair on Jul 08, 2018, 01:29 PMYou need to make a mysql account.

and where might that be on xampp if u say i already ave a phpmyadmin account, <-- if thats not correct kindly tell me where to make ma acc
Title: Re: Coonect php to server DB
Post by: Xmair on Jul 08, 2018, 01:56 PM
You need to learn MYSQL, from your replies it clearly shows that you don't know anything about MYSQL.
Title: Re: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 03:43 PM
Quote from: Xmair on Jul 08, 2018, 01:56 PMYou need to learn MYSQL, from your replies it clearly shows that you don't know anything about MYSQL.
wtf lol i own a search engine atleast know more then u XD
Title: Re: Coonect php to server DB
Post by: Xmair on Jul 08, 2018, 04:00 PM
Alright I'm stepping out of this topic after that reply ^.
Title: Re: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 04:12 PM
dude if u still know it why not help us who r in need of positive replies XD, dont just leave anyone without helping him/her or atleast refer someone or to something if u cant help ( dont take serious )
Title: Re: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 05:53 PM
ok i tried again now but still no clue same problem like previous pic

mysql_hostname <- "127.0.0.1";
mysql_database <- "Files/DataBase.db";
mysql_username <- "root";
mysql_password <- "password123";
mysql_port <- "3306";

function onScriptLoad()
{
db <- mysql_connect( mysql_hostname, mysql_username, mysql_password, mysql_database, mysql_port);
   print("Mysql error: " + mysql_errno());
   if( db ) print( "[SERVER] Connection to mySQL database successful." );
   else print( "[SERVER] Connection to mySQL failed." );
}
Title: Re: Coonect php to server DB
Post by: vitogta on Jul 08, 2018, 06:53 PM
Quote from: MEGAMIND on Jul 08, 2018, 05:53 PMmysql_database <- "Files/DataBase.db";
db <- mysql_connect( mysql_hostname, mysql_username, mysql_password, mysql_database, mysql_port
Are you trying to use mysql or sqlite?
Title: Re: Coonect php to server DB
Post by: Sk on Jul 08, 2018, 07:14 PM
Well, You can not use a .db database in mysql, because that ruins the whole point of using mysql in the first place. The correct parameters are already told by @!  If you want to connect your local db with php then, you don't need to switch to mysql, as php has a very vast range to connect with shit lot of things you and I can never imagine. Here is a tutorial which will help you https://www.a2hosting.com/kb/developer-corner/sqlite/connect-to-sqlite-using-php
I don't need to explain any further as you are the "GREAT OWNER OF AN AWESOME SEARCH ENGINE" (probably some nulled script from the internet)
Title: Re: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 07:32 PM
Lol (probably some nulled script from the internet) k if u find something same as it let me know and no need of ur nab comments when u dont know wtf is goin on.   topic was already solved.... So locking this shit bcz of useless replies
Title: Re: Coonect php to server DB
Post by: MEGAMIND on Jul 08, 2018, 07:57 PM
Quote from: EK.IceFlake on Jul 08, 2018, 08:33 AMYes. https://secure.php.net/manual/en/book.mysqli.php
thanks to flake.....