connect database

Get help using Construct 2

Post » Tue May 21, 2013 3:56 pm

hello guys! , i wanna ask something how do i make a connection to database like phpmyadmin or sql ?? i wanna make a game with redeem code for transaction with real money
B
3
Posts: 3
Reputation: 181

Post » Tue May 21, 2013 4:05 pm

I'm pretty obsessed with WebSockets right now, and the way I would personally do that would be using Websockets to connect to an external server and have that communicate with a database.

However, a much simpler way would be to use PHP code. You will have to write it from scratch, but PHP does give you some methods to help connecting to the database. It's how PHPMyAdmin works (hence PHP).

There is an example in the tutorial section on how to make a chat application with a MySQL database, you can easily adapt that to your own needs. All it takes is a little knowledge of Structured Query Language Statements, like "SELECT * FROM table WHERE ID=1" (Select all the users from this table that have 1 as their ID number).

Oh, and by the way, PHPMyAdmin is not actually a database. MySQL is the database that PMA connects to. So PMA is just a database client. Also, for aproject like this, I would use MySQL instead of something like Microsoft SQL Server. MySQL is much easier to use.

Hope this helps :) Let me know if you need any other advice/help :P
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Tue May 21, 2013 4:24 pm

thanks for reply.
i have knowledge from sql query but i dont know using them with construct2...
thanks for advice maybe now im trying using websockets to connect db.sql at PHPmyadmin..
B
3
Posts: 3
Reputation: 181

Post » Tue May 21, 2013 4:35 pm

If you do use WebSockets, you will need to write a Server from scratch to handle the database logic.

If you're good with C#, I recommend using the Fleck server as your base (Google it!). C# is good because you can easily connect to MySQL through it.

If you prefer JavaScript, you can use Node.JS with the WebSocket and MySQL plugins installed.

It would be easier to look at that PHP chat program and adapt it to your own needs, but WebSocketing is more fun in my opinion :P whichever's best for you :)

By the way, you said you wanted to use this to make transactions? Have you considered Clay.IO? They allow you to integrate In-App Purchases through their own desktop platform. They've even written their own C2 Plugin for us! They also provide an Advertisement API for more ways to earn money. You should check it out: go to http://clay.io and go to the developer section to find out more.
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Tue May 21, 2013 4:55 pm

thanks alot guys... you're awesome.. im very blind about this step how to i start.. at past i just create game for fun and play for myself.. but i have to move to make some profit at my country.. i do alone but i don't know how to start it for make real transaction.. thanks
B
3
Posts: 3
Reputation: 181


Return to How do I....?

Who is online

Users browsing this forum: Matthew de and 22 guests