Php and Mysql help needed

14 replies
I`m a beginner , this is my first project using php and mysql. I`m creating something like a browser-based game. I have a table for users , with 10 rows (but i`m adding more and more rows daily) and I need to create a new table to store the results of every mission of a given player. The problem is that I want to create more than 100 missions so thats mean more than 100 rows for the missions table. My question is how would be the best to store the missions result , and how many users can have my website , is there a limit for mysql ?:confused:
#mysql #needed #php
  • Profile picture of the author aaron_nimocks
    I wouldn't worry about a limit. MYSQL can handle it.

    If I am getting you right I would...

    Create a table for missions.
    Then each row would hold the missions specifics.

    Create a table for users.
    Then each row would hold the info for the user. Login/Password and specific data that you want to hold. (points, missions completed, name, ect.)

    Not sure all the info you need to save for each mission but I would just save it all on the specific user row.
    Signature

    My free PSD logs can be downloaded at PSD Bum. Enjoy!

    {{ DiscussionBoard.errors[1544565].message }}
    • Profile picture of the author coolboycsaba
      Originally Posted by aaron_nimocks View Post

      I wouldn't worry about a limit. MYSQL can handle it.
      Mysql can handle 1.000.000 users in a single table ?
      Signature
      {{ DiscussionBoard.errors[1544614].message }}
      • Profile picture of the author Manfred Ekblad
        Yes.

        If you are worried about performance, then it's a good idea to keep track of the execution time of your application as well as the database performance and the query execution time.
        {{ DiscussionBoard.errors[1544641].message }}
      • Profile picture of the author aaron_nimocks
        Originally Posted by coolboycsaba View Post

        Mysql can handle 1.000.000 users in a single table ?
        Sure. People have tested with billions.

        The more you have in there the slower it will be. Keep that in mind when building it.

        You may want to make more tables so theres less rows in each.

        Mission 1
        Mission 2
        Mission 3

        etc.

        The more rows you have the longer it takes to find the row when doing a search in that table.
        Signature

        My free PSD logs can be downloaded at PSD Bum. Enjoy!

        {{ DiscussionBoard.errors[1544643].message }}
  • Profile picture of the author Manfred Ekblad
    Yes, and while you're at it, build a database cluster as well and don't forget to have it all memcached kidding... but here is a link to some stuff about database performance and optimizing MySQL queries using indexes.

    Optimizing MySQL: Queries and Indexes

    What's your online game about anyway?
    {{ DiscussionBoard.errors[1544673].message }}
  • Profile picture of the author coolboycsaba
    Thanks for all these replies ! Now I`m no more worried :d
    Signature
    {{ DiscussionBoard.errors[1544767].message }}
  • Profile picture of the author Mr. Enthusiastic
    Originally Posted by coolboycsaba View Post

    I`m a beginner , this is my first project using php and mysql. I`m creating something like a browser-based game. I have a table for users , with 10 rows (but i`m adding more and more rows daily) and I need to create a new table to store the results of every mission of a given player. The problem is that I want to create more than 100 missions so thats mean more than 100 rows for the missions table. My question is how would be the best to store the missions result , and how many users can have my website , is there a limit for mysql ?:confused:
    Hi, here's what I recommend.

    Have a USER table. This includes user ID number column, which is an id field, not null, auto increment, and also includes a user name column. Whatever else you want to keep track of about users - other than their missions - goes here.

    Have a MISSION table. This includes a user ID number column to cross reference the user for each mission. Include a foreign key constraint to guarantee that each mission is associated with a valid user.

    Look for a how-to article on database normalization, because this is a perfect start to your system.
    {{ DiscussionBoard.errors[1544772].message }}
  • Profile picture of the author coolboycsaba
    another question :d
    Now i`m using a free webhost for testing the website before releasing it and at my cp I saw that i have a mysql size limit of 9mb , what is that meaning and how many places is needed to store 1.000.000 users each with 100 missions ?
    Signature
    {{ DiscussionBoard.errors[1544791].message }}
    • Profile picture of the author aaron_nimocks
      Originally Posted by coolboycsaba View Post

      another question :d
      Now i`m using a free webhost for testing the website before releasing it and at my cp I saw that i have a mysql size limit of 9mb , what is that meaning and how many places is needed to store 1.000.000 users each with 100 missions ?
      If you are testing then you wont have a million users. That size should be good enough to make your game and test it before moving it to a server. This size of the game and users it seems you are expecting you will probably need an expensive server.
      Signature

      My free PSD logs can be downloaded at PSD Bum. Enjoy!

      {{ DiscussionBoard.errors[1544800].message }}
    • Profile picture of the author Mr. Enthusiastic
      Originally Posted by coolboycsaba View Post

      another question :d
      Now i`m using a free webhost for testing the website before releasing it and at my cp I saw that i have a mysql size limit of 9mb , what is that meaning and how many places is needed to store 1.000.000 users each with 100 missions ?
      Your free host will likely shut off your account for excessive usage before you get to a million users. With a million users, you should be able to easily afford to pay for an appropriately sized servers.

      With a 9 megabyte limit and one million users, you'd get to have nine bytes per user. Considering that first and last name alone are likely to run to 20 or 30 bytes, there's no way your free host could be suitable for what you envision. If you let people choose a login ID and password, enter their email address, and have any kind of user profile information, you're likely up to hundreds of bytes per user even before they have their first mission. That would let you have something like 3,000 users per MB if none of them have any missions.

      Since you haven't said anything yet about what's involved with the missions, there's no way to speculate how large your missions table will grow or whether it will need additional tables to keep track of each mission's details.
      {{ DiscussionBoard.errors[1544805].message }}
    • Profile picture of the author Manfred Ekblad
      Originally Posted by coolboycsaba View Post

      another question :d
      Now i`m using a free webhost for testing the website before releasing it and at my cp I saw that i have a mysql size limit of 9mb , what is that meaning and how many places is needed to store 1.000.000 users each with 100 missions ?
      The database data is stored in files which occupies a bit of disk space. In your case, the web host has set your limit to 9MB. So, you are allowed to store data up to the limit of 9MB.

      How much space do you need? That depends on what kind of data you store in the user and mission table. You can google "how to calculate the size of mysql database" to find out more.

      But, in your case, I would recommend that you grab a copy of XAMPP so that you can test your web application on your own computer.
      {{ DiscussionBoard.errors[1544827].message }}
  • Profile picture of the author Mr. Enthusiastic
    Manfred's got a great idea there.

    If the game really does have a million-user potential, then you should spend all of your time raising money, establishing a business structure, and hiring (or making joint venture, profit-sharing deals) with programmers who already know how to program a site that large.

    Trying to do something like this on your own makes no more sense than Donald Trump taking a year off to learn how to weld before he makes a new skyscraper deal, or Richard Branson learning how to be a 747 pilot before expanding his airline.
    {{ DiscussionBoard.errors[1544860].message }}
  • Profile picture of the author coolboycsaba
    I have a good idea: I will add 2 new rows to the users table: mission id and missionenddate
    I will create a table: missions , where I will add each mission like the users (in 5rows) .
    Signature
    {{ DiscussionBoard.errors[1545324].message }}
    • Profile picture of the author KirkMcD
      Originally Posted by coolboycsaba View Post

      I will add 2 new rows to the users table: mission id and missionenddate
      You mean columns, not rows.
      Each indivdual record is a row.

      You might actually want to put mission_id and mission_end_date in a seperate table and include the user_id.
      {{ DiscussionBoard.errors[1547598].message }}

Trending Topics