Jump to content
xisto Community
Sign in to follow this  
BuBBaG

How To Make An Ultimate Game List. If youre making a site on video games or such.

Recommended Posts

Hello. I am BuBBaG. You can call me Bubba for short.
I'm going to show you how to make an Ultimate Game List.

First off, we need to make a database, we are going to call this database `my_db`, leave out the `'s.
Inside that database we will need to create a table called `ugl'(Ultimate Game List, duh).

To make the table, simply enter this in the Syntax.

CREATE TABLE ugl(System char(50),Game char(50),)

In the above code, it is stating we are creating a table called ugl, with two columns, System, and Game.

Next, we will need to make a form, to submit Games to the list.

<html><body><p>Here you can post a game you would like to see on The Ultimate Game List!<br>Just fill in the corresponding boxes with the correct information, please.</p><br><form action="insertgame.php" method="post">System Game is Made For: <input type="text" name="System" /><br>Game name: <input type="text" name="Game" /><br><input type="submit" /></form></body></html>

In the above code, HTML is being used. The action is post. This sends the information to the page `insertgame.php`, that we will be creating in a moment. On the `insertgame.php` page, the information connects to the database, then dropping the info into the table `ugl` we creating a few minutes ago.

Now, we must create the `insertgame.php` file. Open up notepad, or anything else you can paste this code into and save it to `insertgame.php`.

<?php$con = mysql_connect("localhost","your_username","your_password");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("my_db", $con);$sql="INSERT INTO ugl (System, Game)VALUES('$_POST[system]','$_POST[game]')";if (!mysql_query($sql,$con))  {  die('Error: ' . mysql_error());  }echo "Game Added! Click here to get back to the game.(put a link back to the page where you submit the game.";mysql_close($con)?>

That is `insertgame.php`.That connects to the database we created earlier, `my_db`. Then it connects to the table `ugl` that we also created earlier.

Now, we are almost done, just one more code.
This is the code that displays the information of the games in the list.
Would look like this...
-----------------+-----------------
-System + Game -
Playstation 2 + Demo Disk -
blah + blah blah -
etc. etc.


<?php$con = mysql_connect("localhost","your_username","your_password");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("my_db", $con);$result = mysql_query("SELECT * FROM ugl");while($row = mysql_fetch_array($result))  {  echo $row['System'] . " " . $row['Game'];  echo "<br />";  }mysql_close($con);?>
In that code, it is telling the database to display the table `ugl` with the `SELECT * FROM ugl`, statement.
Now, you put that on whatever page you want the list to be on, I would suggest the page the submit form is on, but that's my choice.

If you do do that. That page should look a little something like this.
<?php$con = mysql_connect("localhost","your_username","your_password");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("my_db", $con);$result = mysql_query("SELECT * FROM ugl");while($row = mysql_fetch_array($result))  {  echo $row['System'] . " " . $row['Game'];  echo "<br />";  }mysql_close($con);?><html><body><p>Here you can post a game you would like to see on The Ultimate Game List!<br>Just fill in the corresponding boxes with the correct information, please.</p><br><form action="insertgame.php" method="post">System Game is Made For: <input type="text" name="System" /><br>Game name: <input type="text" name="Game" /><br><input type="submit" /></form></body></html>
.

Well, thank you for your time, if you have any questions, feel free to post them here, or PM them to me, I'll gladly answer them.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.