Jump to content

AltarofScience

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Everything posted by AltarofScience

  1. You guys are really confusing. Players are able to build an infinite amount of any single building(theoretically, colonies have a stat called total building slots that rarely goes over 50000.) There is theoretically an infinite number of different kinds of buildings for each type, and there are about 20 types of buildings. So for just iron mines I have: iron mine 1 iron mine 2 iron mine 3 - - - - - - then a player can build any number of each of those buildings. i don't want to call a count of how many different kinds of iron mines i can build. i know how to do that. i want to call a count of how many of each kind of iron mine i have built on a single colony, and this data needs to be stored for every colony. and i also need to store a count of how many of each other type of building i have built. for all 20 building types, for each colony. that table is identical to the table juddster posted, excepting i added a new column and it displays for rows of the table. the columns are abbreviations of his columns. building id colony id blueprint id building type id name
  2. wait do you want to make the building table like this: bid cid btid bpid name amount 0 0 0 0 bim 1 1 0 0 1 obim 0 0 1 0 0 bim 0 1 1 0 0 obim 1 so there are always only 5 columns, but the number of rows increases. so: colony one has 1 building of type "btid 1 bpid 0" and no buildings of type "btid 1 bpid 1" colony two has no buildings of type "btid 1 bpid 0" and 1 building of type "btid 1 bpid 1"
  3. no i mean the way he is querying the relational database/designed the database. not that there isn't a structure to do it in sql, just it doesn't seem to be in his examples. where is the number of buildings stored in that table structure? i cannot find it.
  4. I will clarify. Although if I could get a large enough player base I would need to clear inactive accounts overtime, I doubt that will happen, so users are permanent. Each blueprint is created by a user through the science system. You can only name a blueprint once. Although a blueprint might get 'deleted' or 'archived' if it is deleted and no other player has it it will go to a forgotten knowledge table and other players will be able to buy it. But names are still static. Colonies are made by players, currently with a link to a page that holds a script since I haven't made colony ships yet. Colonies can be conquered, if the conquering player has a colony on the planet the conquered colonies stats are added to the new colony and that colony ceases to exist. If they don't have one it merely changes colony ownership. Colonies have a default name when created, and can be renamed also. what do the u. c. b. things mean in your code? and what do you means stores it in relationships? that has me confused. if i have 20 of a building, that 20 has to be recorded somewhere for the query to call. Maybe I was not clear, each building can be built many times. So if I have 10 different iron mines, I might have something like this: 1 15 2 12 3 4 4 45 5 11 6 32 7 3 8 24 9 0 10 100 The only thing I can get from your code is that you think each building can only be built once, like in say, civilization or ogame or something. This is not the case.
  5. Okay, for the blue print part, it looks like you are storing all the blueprints in one table. I presume the red things are foreign keys? For the usersblueprints table, how does that store which users have access to which prints? Is it listing the same user id more than once like: 1 1 1 2 1 5 1 8 2 1 1 9 2 3 2 4 3 6 3 7 And then i say select from bpid where uid= and then the id corresponding to the session user name from the users tables? I set up the colony table by storing the having a username column and then calling all rows from the table where the session username equals the text in the username column. I did the same for the blueprints table. But I am guessing you want me to grab the user id that corresponds to the session username and run the queries with that instead? I think I understand the way the foreign keys interact in your structure, but I am still not clear on how I am gathering the building count. If I have built 20 Basic Iron Mines on Colony A and 35 on Colony B, where Basic Iron Mine is the blueprint name, how does that structure record how many iron mines are on each colony?
  6. I don't see where you are storing the number of buildings on a colony in there. That structure confuses me, but I can sort of see what you are doing. I don't really understand how relations in databases work. I will go look it up though. Just curious though, why are spreadsheets bad?
  7. I was very clear on what I need to do. I need to store a set of buildings for each colony. Now that you say it it sounds sort of like a spreadsheet. Would I be able to integrate a spread sheet into a php/mysql based site? And how would I gather the data from the spreadsheet? Really though I did make a table that works like a spreadsheet. The amount of testing I've done so far hasn't turned up any problems. It works just like I want, but if you think a spreadsheet would work better, how would I do that?
  8. Tables have a limited number of columns so if I stored all the data in 1 table I could have like 10000 columns, and that's impossible. This way tables will have 200 or less columns, most will be like 20-100. The posters kept claiming that having dynamic columns was a bad idea, but then they failed to provide me with an alternate solution so I will have to add columns dynamically anyways. Having a table for each colony, which is what fenway wanted me to do, is impossible because who wants to manage 10000 tables in a database? That is just stupid.
  9. I came up with a new organization for my tables, which I think is what I will use, since I still haven't gotten a good response: Since a given player is unlikely to make more than 200 colonies, I am going to make tables where columns store the colony id. I will set the rows as buildings since there could be as many as 100k rows in a table, although its very unlikely, and there are likely to be only 100 columns or so. Each player will have their own table.
  10. you want me to make a table for each building and then use colonies as rows? or a table for each colony and then use buildings as rows? so many tables arg... what about this? on colony creation it adds the row to the colony table and then calls the pk value back, and creates a table called that. so if i had 0 colonies and made a new one it would be idcol 1 as a new row in colonies and 1 as the name of a table. every time a player added a new print that is a building it would ad a new row to the table. then when i wanted to build something i would write UPDATE $idcol(built) VALUES($built) one thing though, that would give up to like 10000 tables. is having that many tables a problem?
  11. because each column represents a building. so that i can say select * from table where idcol = idcol that way i can call the number of buildings for each building type on a given colony. What I Need To Do: Colonies can have buildings. Each building is based on a blueprint. Players can create new blueprints. That means I need to add either a row or a column allowing a player to build their new building. Players can also create new colonies. That means I need to add either a row or a column allowing a new colony to have data on how many of each type of building are built.
  12. i have been told that. okay so i need to store the building data of each colony. new colonies will be created by players. new buildings will be created by players. explain to me a better way than adding new columns.
  13. i use mysql not mysqli but: $q = "INSERT INTO videos(src) VALUES ('text')"; should be the proper way to write that query, or in the original query: $id=$_POST['id']; $q = "INSERT INTO videos(src) VALUES ('$id')";
  14. could you post the entire code, including what variables you declared?
  15. i have a separate table containing the stats of all the buildings. But I need a way to store how many buildings each colony has. The number of buildings possible to make and the number of colonies a player has both change.
  16. Basically the table is like: id name name name name 1 0 0 0 0 2 0 0 0 0 new prints make a new column and new colonies make a new row.
  17. I am making a game. Part of the game is having various buildings built. I set the first column as the id of the colony and the others as the names of the buildings. I could switch it up but either way the numbers of columns will change.
  18. Because I'm dumb and I write weird code. Is that question your way of saying I can't do that?
  19. Okay, so I need to create a new row in a mysql table, but i only want to inset 1 value and have the rest set to default, which is 0. but, the number of columns in the able is always going to be changing, and the code is going to stay the same. How would i write the INSERT query for that?
  20. i don't know. i assume you can if the original did it, provided you change the code a bit. i am actually very new at php, i only learned it to clone a browser game i was banned from(right before one of the staff playing in the server conquered my player group ) and i only started doing the php codes for it about a two weeks ago, and i have really been slacking off aka trying not to fail my college classes, so i'm not very good. i actually didn't read you code that much, although i presume i could figure it out if i had time, so i don't know how your forms and php scripts really work. i am fairly certain i didn't alter any of the actual processing code, just the html tags, so if you have a problem i presume the issue revolves around having all the elements on the same page. sorry i'm not more helpful.
  21. Create a file called wtf.php in your server public_html or equivalent directory. You will find that the code processes perfectly correctly. It does echo some errors prior to putting inputs in, i would say try isset() so that the code only executes if the variable in isset() is set. although i can't be totally sure that will make errors stop displaying. either way the code displays in firefox as 4 divs with grey and blue styling and what i presume are the correct things because when i input something with the form the output changes. i used an internal style sheet so that i would only have to create one file which was easy to delete from my server folder once i figured out that it was working properly. you can change the name to whatever you want as long as you change the action="" part of the form to the correct new page name. you want the form to go back the the same page as you were on, now that the files arent on separate pages. also obviously you can return to having an external style sheet by change the header to link to it. <html> <head> <style type="text/css"> div.note { font-size: xx-small; color: red ; } div.output { font-size: large; } div.block { width: 500px; border: 2px solid blue ; background: #cccccc; } </style> </head> <body> <div class="block"> <form action="wtf.php" method="post"> ENTER INPUT1(A or B): <select name="input1"> <option>A</option> <option>B</option> </select> <input type="submit" value="ENTER"/> </form> </div> <div class="block"> <?php $choice=$_POST["input1"]; if($choice=="A") { echo "<form action='wtf.php' method='post'>"; echo "<input type='hidden' name='input1' value='5'/>"; } else if($choice=="B") { echo "<form action='wtf.php' method='post'>"; echo "<input type='hidden' name='input1' value='1'/>"; } else { echo "<form action='wtf.php' method='post'>"; } ?> ENTER INPUT2(1-10) : <input type='text' name='input2' size='3'> <input type="submit" value="ENTER"/> </form> </div> <div class="block"> <?php $x="1"+$_POST["input1"]; $y="1"+$_POST["input2"]; $z=(int)$x+(int)$y+2; echo "<div class='output'>OUTPUT: "; if($y<=15) { echo "$z.$y.$x";} else { echo "$x.$y.$z";} echo "</div>"; ?> <div class="note">MAKE SURE TO COPY/WRITE THE OUTPUT</div> <a href="wtf.html">RESTART</a> </div> <div class="block"> <?php $xf="1"+$_POST["input1"]; $xz="2"+$_POST["input2"]; $xaq=(int)$xf; $xax=(int)$xz; if($xaq>$xax) {$xaq=$xaq+33;$xax=$xax+31;} else {$xaq=$xaq+2;$xax=$xax+44;} echo "<div class='output'>OUTPUT: "; echo "$xf.$xaq.$xax.$xz"; echo "</div>"; ?> <div class="note">NOTE: MAKE SURE TO COPY/WRITE THE OUTPUT</div> <a href="wtf.html">RESTART</a> </div></body></html> obviously we want you to be able to perform this operation yourself in the future, so i will try to explain what i did. firstly i put all the code in a single set of html tags: <html> <head>\\style sheet</head> <body> \\all of the code </body> </html> then i changed the action tags because otherwise it tried to go to a nonexistent file: step1.php step2.php step3.php step4.php and obviously i don't have those files on my server. of course i also used an internal style sheet with the CSS you provided in the thread, since i don't have the file you linked to externally.
  22. you want all the html elements to exist on the same page? you need to take the code i edited for you and save it as a file. then open it in the browser. then you need to open the CSS document and edit it so that the elements are displayed properly. alternatively if you want to keep the separate files but have them display together you could use include(''); and have other files that include the specific pages you want.
  23. You neglected to ask a question. But he did state an objective
  24. This! I love you. Thank you so much. It works! I don't have to learn vb or C++! Thank you Jesus!
  25. I merged the pages, but i do have one question, are you editing the CSS file. Can you show it to me? In order to merge the documents properly I have to know what sorts of layout changes you are making with CSS styling. Did you alter element positions or anything like that? <html> <head><title>STEP1</title><link rel="stylesheet" type="text/css" href="steps.css" /></head> <body> <div class="block"> <form action="step2.php" method="post"> ENTER INPUT1(A or B): <select name="input1"> <option>A</option> <option>B</option> </select> <input type="submit" value="ENTER"/> </form> </div> <div class="block"> <?php $choice=$_POST["input1"]; if($choice=="A") { echo "<form action='step4.php' method='post'>"; echo "<input type='hidden' name='input1' value='5'/>"; } else if($choice=="B") { echo "<form action='step3.php' method='post'>"; echo "<input type='hidden' name='input1' value='1'/>"; } else { echo "<form action='step1.html' method='post'>"; } ?> ENTER INPUT2(1-10) : <input type='text' name='input2' size='3'> <input type="submit" value="ENTER"/> </form> </div> <div class="block"> <?php $x="1"+$_POST["input1"]; $y="1"+$_POST["input2"]; $z=(int)$x+(int)$y+2; echo "<div class='output'>OUTPUT: "; if($y<=15) { echo "$z.$y.$x";} else { echo "$x.$y.$z";} echo "</div>"; ?> <div class="note">MAKE SURE TO COPY/WRITE THE OUTPUT</div> <a href="step1.html">RESTART</a> </div> <div class="block"> <?php $xf="1"+$_POST["input1"]; $xz="2"+$_POST["input2"]; $xaq=(int)$xf; $xax=(int)$xz; if($xaq>$xax) {$xaq=$xaq+33;$xax=$xax+31;} else {$xaq=$xaq+2;$xax=$xax+44;} echo "<div class='output'>OUTPUT: "; echo "$xf.$xaq.$xax.$xz"; echo "</div>"; ?> <div class="note">NOTE: MAKE SURE TO COPY/WRITE THE OUTPUT</div> <a href="step1.html">RESTART</a> </div></body></html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.