Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Edit joke</title>
- </head>
- <body>
- <?php
- $dbCon = @mysql_connect(not for public viewing);
- if (!$dbCon){
- exit("<p>Unable to connect to the database server at this time.</p>");
- }
- if (!@mysql_select_db("ijdb")) {
- exit("<p>Unable to connect to the database at this time.</p>");
- }
- ?>
- <?php
- if(isset($_POST['joketext'])):
- if (empty($_POST['joketext']))
- {
- exit("<p>You must include some joke text before updating a joke.</p>");
- } else
- {
- echo "Your amends have been noted.";
- }
- ?>
- <?php elseif(isset($_GET['id'])):
- $jId = $_GET['id'];
- $gJoke = @mysql_query("select idd,joketext,authorid from joke");
- if (!$gJoke)
- {
- exit("<p>Unable to retrieve joke at this time.");
- } else
- {
- while ($grabJokes = mysql_fetch_array($gJoke))
- {
- $grabJokeId = $grabJokes['id'];
- $grabJokeText = $grabJokes['joketext'];
- $grabJokeAuthor = $grabJokes['authorid'];
- echo "<p>" . $grabJokeId . " | " . $grabJokeText . " | " . $grabJokeAuthor . "</p>\n\t";
- }
- }
- $gAuth = @mysql_query("select id,name from author");
- if (!$gAuth)
- {
- exit("<p>Unable to retrieve authors at this time.");
- }
- while ($grabAuthors = mysql_fetch_array($gAuth))
- {
- $grabAuthorId = $grabAuthors['id'];
- $grabAuthorName = $grabAuthors['name'];
- echo "<p>" . $grabAuthorId . " | " . $grabAuthorName . "</p>\n\t";
- }
- $gCat = @mysql_query("select id, name from category");
- if (!$gCat)
- {
- exit("<p>Unable to retrieve categories at this time.</p>");
- }
- while ($grabCategories = mysql_fetch_array($gCat))
- {
- $grabCatId = $grabCategories['id'];
- $grabCatName = $grabCategories['name'];
- echo "<p>" . $grabCatId . " | " . $grabCatName . "</p>\n\t";
- }
- $gJokeCats = @mysql_query("select jokeid, categoryid from jokecategory");
- if (!$gJokeCats)
- {
- exit("<p>Unable to retrieve joke categories at this time.</p>");
- }
- while ($grabJokeCatories = mysql_fetch_array($gJokeCats))
- {
- $grabJokeCatJokeId = $grabJokeCatories['jokeid'];
- $grabJokeCatCatId = $grabJokeCatories['categoryid'];
- echo "<p>" . $grabJokeCatJokeId . " | " . $grabJokeCatCatId . "</p>\n\t";
- }
- ?>
- <h1>Edit joke</h1>
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
- <p>Edit joke text: </p>
- <p><textarea cols="45" rows="5" name="joketext"></textarea></p>
- <p>Edit joke author:</p>
- <p>
- <select name="aid">
- <option value="">test</option>
- </select>
- </p>
- <p>Edit joke categories:</p>
- <p>
- <input type="checkbox" name="CATSARRAY" value="" /> Hello
- </p>
- <p><input type="submit" /></p>
- </form>
- <?php
- endif;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement