How to allow Unity3D to communicate with mySQL

Discussion in 'General Webmaster Support' started by Volkof, Sep 8, 2012.

  1. Volkof

    Volkof Well-Known Member

    Ratings:
    +31 / 0 / -0
    Hi all,

    I am working on a Project that requires creating a survey using Unity3D, and uses mySQL to store results.

    Problem is, Unity3D does not seems to be able to communicate directly with mySQL, and requires a middleman (like PHP) to do so.

    Is there any way to NOT use a middleman?
     
  2. UndeadDragon

    UndeadDragon Super Moderator Staff Member

    Ratings:
    +450 / 0 / -0
    I doubt there would be an easy way to directly communicate.

    If you wanted to use PHP it would be very simple like so: (very basic form)

    Code:
    <?php
     
    mysql_connect('MYSQL_HOST', 'MYSQL_USERNAME', 'MYSQL_PASSWORD');
    mysql_select_db('MYSQL_DB');
     
    mysql_query('INSERT INTO users VALUES ('username', 'password');
    
     
  3. Magentix

    Magentix if (OP.statement == false) postCount++;

    Ratings:
    +107 / 0 / -0
  4. Volkof

    Volkof Well-Known Member

    Ratings:
    +31 / 0 / -0
    Thanks guys.

    After much discussion with my group members, we decided to go with PHP
     
  5. GetTriggerUnit-

    GetTriggerUnit- DogEntrepreneur

    Ratings:
    +128 / 0 / -0
    Make sure you use mysqli or pdo, because the basic php mysql api is deprecated.
     
  6. DrEvil

    DrEvil FCRI Associate!

    Ratings:
    +111 / 0 / -0
    I still don't understand how this is safe.
    So we are assuming people can look through the code to find the DB credentials... they will find the urls to set/get highscores and the md5 hash to be used. Therefore allowing them to set whatever highscores they want.

    I'm not sure if I am missing the point of it, but I cannot seem to make sense of it.:(
     
  7. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    Why do you say that?
     
  8. GetTriggerUnit-

    GetTriggerUnit- DogEntrepreneur

    Ratings:
    +128 / 0 / -0
    This is considered deprecated my many php developers. It does the job but it's a very old API. There are much more interesting functions with mysqli or pdo, for instance multi query / stored procedures.
     

Share This Page