Jump to content

Need this Upload Form to Generate a URL


Mesden

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.
Link to comment
Share on other sites

  • Replies 79
  • Created
  • Last Reply

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?

Link to comment
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?

Link to comment
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..)
Link to comment
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.

Link to comment
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?
Link to comment
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.

Link to comment
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.

Link to comment
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.
Link to comment
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.

Link to comment
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
Link to comment
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

Link to comment
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.
Link to comment
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.
Link to comment
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.

Link to comment
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...
Link to comment
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 ,
Link to comment
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?

Link to comment
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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...