Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Achievement CMS</title>
- </head>
- <body>
- <h1>Delete Games</h1>
- <?php include_once('connect.php');
- if (isset($_POST['title'])):
- $title = $_POST['title'];
- $id = $_POST['id'];
- $sql = "UPDATE games SET
- title='$title' WHERE id='$id'";
- if (mysql_query($sql))
- {
- echo 'Game updated successfully <br><br>';
- } else {
- 'There was a problem updsating the game'.
- 'Error: ' . mysql_error() . '';
- }
- ?>
- <br>
- <a href="games.php">Return to Games list</a>
- <?php else:
- $typeid =$_GET['typeid'];
- $id = $_GET['id'];
- $title = mysql_query("SELECT title FROM games WHERE id='$id'");
- $type = mysql_query("SELECT type FROM type WHERE typeid='$typeid'");
- $drop_down = mysql_query("SELECT * FROM type ORDER BY '$typeid'");
- if(!$title)
- {
- exit('Error fetching game details: ' . mysql_error() . '');
- }
- if(!$type)
- {
- exit('Error fetching game details: ' . mysql_error() . '');
- }
- if(!$drop_down)
- {
- exit('Error fetching game details: ' . mysql_error() . '');
- }
- $title = mysql_fetch_array($title);
- $type = mysql_fetch_array($type);
- $name = $title['title'];
- $category = $type['type'];
- $type = $drop_down['type'];
- ?>
- <form action="<?php echo$_SERVER['PHP_SELF'];?>" method="post">
- <p>Edit the details below:</p>
- <label>Game title: <input type="text" name="title" value="<?php echo $name; ?>"/></label><br>
- Game Category:
- <?php
- echo "<select name=\"name\">";
- if(mysql_num_rows($drop_down))
- {
- while($row = mysql_fetch_assoc($drop_down))
- {
- echo "<option>$row[type]</option>";
- }
- }
- else {
- echo "<option>No Names Present</option>";
- }
- ?>
- <input type="hidden" name="id" value="<?php echo $id;?>"/>
- <input type="submit" value="Submit" />
- </form>
- <?php endif; ?>
- </td>
- </tr>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement