Php and Mysql help needed

by 14 replies
16
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:
#programming #mysql #needed #php
  • 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.
    • [1] reply
    • Mysql can handle 1.000.000 users in a single table ?
      • [2] replies
  • 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?
  • Thanks for all these replies ! Now I`m no more worried :d
  • 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.
  • 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 ?
    • [3] replies
    • 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.
    • 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.
    • 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.
      • [ 1 ] Thanks
  • 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.
  • 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) .
    • [1] reply
    • 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.

Next Topics on Trending Feed

  • 16

    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: