0 Favourites

connect database

  • 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

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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..

  • 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 clay.io and go to the developer section to find out more.

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)