Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Database support?  (Read 3908 times)

0 Members and 1 Guest are viewing this topic.

spikaa

  • Newbie
  • *
  • Posts: 2
    • View Profile
Database support?
« on: May 05, 2011, 02:20:31 am »
Hi does SFML support PHP/MySQL?

I'm looking into using SFML for a multiplayer game that stores username and records statistics.

Thanks

Wizzard

  • Full Member
  • ***
  • Posts: 213
    • View Profile
Database support?
« Reply #1 on: May 05, 2011, 03:01:29 am »
SFML will not run scripts (e.g., PHP) for you, manipulate databases (e.g., MySQL) for you, or run servers (e.g., web servers) for you.

However, it allows you to interface with servers through the TCP, UDP, HTTP, and FTP protocols and
it allows you to code your own TCP-derived and/or UDP-derived server (e.g., web server, FTP server, or a custom server).

spikaa

  • Newbie
  • *
  • Posts: 2
    • View Profile
Database support?
« Reply #2 on: May 05, 2011, 03:50:32 am »
I'm quite confused. Please be patient with me as I'm very new with this.

So, are you saying SFML cannot connect to a MySQL database? If so, is there any way to create a game that utilizes a database with SFML?

Thanks

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Database support?
« Reply #3 on: May 05, 2011, 04:32:31 am »
You'll need to use another library for database access (e.g. SQLite).
For global statistics, you need to write a server, e.g. in PHP. The C++ client could simply send the local statistics to the server, which would show the global statistics to the web clients.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

fourier

  • Newbie
  • *
  • Posts: 1
    • View Profile
Database support?
« Reply #4 on: May 07, 2011, 06:46:56 pm »
It sounds like you're very new to programming (at least in PHP and C++).

You're saying you'll have a website that shows stats?  The easiest way to do this would be to use SQLite as bastien says.  PHP has support for SQLite as well.  If you want mysql, I would suggest writing the data manipulation in PHP and just having the game server send an HTTP request to the PHP server for processing.  The MySQL connector for C/C++ is a pain to work with, and it will be much easier (and cleaner) just using PHP.

Do some research on the suggestions you've received.  It sounds like you need to before you make any decisions.

 

anything