Jump to content
Mesden

Need this Upload Form to Generate a URL

Recommended Posts

We're starting to go around in circles - you need to make/create/define the kind of content that the table is going to hold. More precisely, you define the kind of content that each column in a row will contain.You do not fill the content itself. Only the kind of content that will later be filled.Once you create a table (i.e. once you specify the kind of content for each column), you can fill actual data in it with insert statements from your PHP code. The ones I told you there's no work around for, and because of which you'll need to write some SQL code. Each time such a statement is executed, it will add a row into the database table.
Yeah, sorry for all these circles. Either I'm not making sense of what's being said here or I'm just not making sense by what I'm asking lol.

Share this post


Link to post
Share on other sites

Looking at this Tutorial, it shows that I need to "Connect to the Database", "Create a Database", Etc.Do I create a whole new PHP File for this? (And name is something like sqlconnect.php), or do I just put it in the PHP File that contains the Upload Form?

Share this post


Link to post
Share on other sites

whats the tutorial? If you're using phpMyAdmin, you should be able to do everything with the UI. However, using PHP, you can execute some of these SQL queries; like for creating tables and databases. However, typically you set most of this stuff up before, like boen robots trying to explain to you. Maybe you should be reading a phpMyAdmin tutorial?

Share this post


Link to post
Share on other sites
whats the tutorial? If you're using phpMyAdmin, you should be able to do everything with the UI. However, using PHP, you can execute some of these SQL queries; like for creating tables and databases. However, typically you set most of this stuff up before, like boen robots trying to explain to you. Maybe you should be reading a phpMyAdmin tutorial?
Well, using PHPMyAdmin will create the tables but I still need to put some coding on the website and connect to the Database... Do I do that in an entirely new .php page or put it with the upload form (or on any other existing page..)

Share this post


Link to post
Share on other sites

ok, if you have already made the tables, then yes, in a PHP script is where you are going to want to connect to the database, and then do what you need to the tables within in it, using SQL.It can be done on the same page that is already handling the form, in fact it is commonly done.

Edited by thescientist

Share this post


Link to post
Share on other sites
no, the individual values need to be inserted into the mysql table. i believe you need to include or require the functions into your php document somehow, the MPQ document is the reference to these functions. as described below, you will need to construct a MySQL INSERT statement to insert the values into your table. :)i would create the variables for this as $valuename = functionname(); (following the MPQ reference of course), in the PHP after the file has been uploaded and opened, where it is parsed.you will be able to retrieve these values later, perhaps if you intend on keeping a store of the files on the server - to keep a path to the file in each record as another field - unless you want to delete the files after parsing them and inserting the values into the mysql database.upon retrieval, these values can then be compiled from the database into a new file, and made available for download. :)
I think I'm getting the hang of this. Should I be using AUTO_INCREMENT?

Share this post


Link to post
Share on other sites
I think I'm getting the hang of this. Should I be using AUTO_INCREMENT?
Created my first table. I think this might be correct:
CREATE TABLE  `Aaron21_Upload`.`preform` (`mapversion` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`maptype` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`mapsize` VARCHAR( 3 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,INDEX (  `mapversion` ,  `maptype` ,  `mapsize` )) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;

And here is the table for Table 2:

CREATE TABLE  `Aaron21_Upload`.`playerresult` (`playername` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`playerrace` VARCHAR( 7 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`playercolor` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`playerteam` VARCHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,INDEX (  `playername` ,  `playerrace` ,  `playercolor` ,  `playerteam` )) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;

How do that look for a first-time coder in phpMyAdmin? Usually I just copy and paste with no idea what any of this means.

Edited by Mesden

Share this post


Link to post
Share on other sites

You're missing an ID column. You know, the first INT, AUTO_INCREMENT column.Also, why two tables? You only need one... or did you suddenly became aware of how DBs work and realized that for repeating data per item, you'll need a separate table or N amount of repeating fields?Either way, an ID is pretty much a must.

Share this post


Link to post
Share on other sites
You're missing an ID column. You know, the first INT, AUTO_INCREMENT column.Also, why two tables? You only need one... or did you suddenly became aware of how DBs work and realized that for repeating data per item, you'll need a separate table or N amount of repeating fields?Either way, an ID is pretty much a must.
I didn't think I needed an Auto Increment Column.. Am I supposed to be representing increasing numbers? Also, I chose two tables for two seperate tables of Information, or does it only call for one table..? Also, which would be the ID? I didn't see a field for ID. Edited by Mesden

Share this post


Link to post
Share on other sites

you make the field for an ID, so that way you know there will always be a unique identifier (preferably numerical) for every record in the table. You would set this specific field to auto increment so that each time a new record is added, it will automatically add a new record with the next available number/ID. This way, everytime a player is added to the database, they have a player ID, so that way you can have two players named Tom, but each will have their own unique numerical identifier. It might be helpful to look up and read about database normalization.

Edited by thescientist

Share this post


Link to post
Share on other sites
you make the field for an ID, so that way you know there will always be a unique identifier (preferably numerical) for every record in the table. You would set this specific field to auto increment so that each time a new record is added, it will automatically add a new record with the next available number/ID. This way, everytime a player is added to the database, they have a player ID, so that way you can have two players named Tom, but each will have their own unique numerical identifier. It might be helpful to look up and read about database normalization.
Oh I looked up a ton of articles on making tables before I started. But I made two tables so I could display that information in different areas of the page it's displayed on. Can I still do that with one table? So everything should be auto incremented? And I thought the id was already in there, like where it says playercolor, maptype, teamsize, or w/e

Share this post


Link to post
Share on other sites

Only the field you make to be a table ID needs to be auto-incremented, typically there's one per table. Typically its also what one chooses as the primary key.As far as how many tables you need, that's up to whatever the needs of the application are. A table represents one set or kind of data; players, maps, messages, posts, members, etc.anyway, it sounds like are still confused about how to setup databases and tables. Here's an article on database normalization, perhaps it will help you out and/or add clarification for common terms, techniques, etc.http://dev.mysql.com/tech-resources/articl...malization.html

Edited by thescientist

Share this post


Link to post
Share on other sites
I didn't think I needed an Auto Increment Column.. Am I supposed to be representing increasing numbers? Also, I chose two tables for two seperate tables of Information, or does it only call for one table..? Also, which would be the ID? I didn't see a field for ID.
I'm still not really clear on what Auto-Increment does. I tried to Google it when I made those Tables but couldn't find anything clear enough to explain what it does.

Share this post


Link to post
Share on other sites
I'm still not really clear on what Auto-Increment does. I tried to Google it when I made those Tables but couldn't find anything clear enough to explain what it does.
So I've got two IDs for the Tables, one is called playerresult, the other is called preform. The Field Names for playerresult are:playernameplayerraceplayer colorplayer teamBut they don't have anything under "Attributes" or "Extra".As for Preform, I've got:mapversionmaptypemapsizeAgain, nothing under "Attributes" or "Extra". I don't see where this ID Field is.

Share this post


Link to post
Share on other sites

just make one. you're confusing all your terms. Player result and preform are the names of your tables. Fields are the columns for defining the kind information that will be stored in it for each record in the database. You need an ID FIELD.example:playerId (set this to auto increment, and as the primary key)playerFirstNameplayerLastNameetcauto increment does exactly what it sounds like it does. http://en.wikipedia.org/wiki/IncrementIf you have no records it starts at 0. When you add someone new, the playerID will auto-increment to 1. Add someone else, it will change to 2. So on and so forth.

Edited by thescientist

Share this post


Link to post
Share on other sites
just make one. you're confusing all your terms. Player result and preform are the names of your tables. Fields are the columns for defining the kind information that will be stored in it for each record in the database. You need an ID FIELD.example:playerId (set this to auto increment, and as the primary key)playerFirstNameplayerLastNameetcauto increment does exactly what it sounds like it does. http://en.wikipedia.org/wiki/IncrementIf you have no records it starts at 0. When you add someone new, the playerID will auto-increment to 1. Add someone else, it will change to 2. So on and so forth.
Would this still be a VARCHAR or would it be something different..? I'm guessing Unique or Integer... Edited by Mesden

Share this post


Link to post
Share on other sites

INT

Share this post


Link to post
Share on other sites
INT
Dropped them and remade into one table, added an ID Field at the top with an auto_increment and primary key of an INT Field.How does this look?CREATE TABLE `Aaron21_Upload`.`parser` (`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,`playername` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`playerrace` VARCHAR( 7 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`playercolor` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`playerteam` VARCHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`mapversion` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`maptype` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,`mapsize` VARCHAR( 3 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,

Share this post


Link to post
Share on other sites

i have no ability to comment on whether they should be one table or not, but typically ID's are a bit more descriptive than just ID, hence my previous example, but whatever works. Why is the table called parser now?

Edited by thescientist

Share this post


Link to post
Share on other sites
i have no ability to comment on whether they should be one table or not, but typically ID's are a bit more descriptive than just ID, hence my previous example, but whatever works. Why is the table called parser now?
Previous table was called 'preform' and 'playerresults', I figured calling it parser would be a bit easier than 'preform and playerresults', lol.

Share this post


Link to post
Share on other sites

oh. I figured you would want to call a table about players "players" but, to each his own.

Share this post


Link to post
Share on other sites

I don't know. why did you make them?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...