WordPress.org

Ready to get started?Download WordPress

Forums

How to create new WordPress table and store high scores from a Unity game (4 posts)

  1. sixfootjames
    Member
    Posted 2 years ago #

    Hi!

    I was hoping someone might be able to help me with this. I need a way to capture high scores from a Unity browser game and store those scores in the WP database please.

    Only logged in users will be able to play the game so therefore, the table would have to be linked to the user table in WP.

    If there is a way to store this kind of information, I would really appreciate some help please.

    Many thanks!

  2. vtxyzzy
    Member
    Posted 2 years ago #

    Here is an article with sample code that shows how to create tables and insert and retrieve rows using WP functions.

    http://wordpress.mcdspot.com/2010/03/15/code-to-dropcreateaccess-mysql-table/

  3. sixfootjames
    Member
    Posted 2 years ago #

    That's a great start thanks vtxyzzy.
    Now all I need is a way to associate the creation of the hi scores table with the user table information. :)

  4. vtxyzzy
    Member
    Posted 2 years ago #

    The article below in the Codex shows how to check if the current user is logged in and how to get the user ID.

    http://codex.wordpress.org/Function_Reference/wp_get_current_user

    All you need to do is include the user ID in your custom table so it can be joined with the wp_users table if necessary. I think you would want to use the user ID as the primary key.

Topic Closed

This topic has been closed to new replies.

About this Topic