Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function clear($message)
- {
- if(!get_magic_quotes_gpc())
- $message = addslashes($message);
- $message = strip_tags($message);
- $message = htmlentities($message);
- return trim($message);
- }
- mysql_connect('localhost','root','123');
- mysql_select_db('r63');
- if(!$_GET['id'])
- {
- $query = mysql_query("SELECT * FROM furniture ORDER BY id DESC");
- echo 'Edit<hr />';
- while($output = mysql_fetch_assoc($query))
- echo $output['item_name'].' » <a href="?id='.$output['id'].'">Edit</a><br />';
- }
- else
- {
- if ($_POST['submit'])
- {
- $public_name = clear($_POST['public_name']);
- $item_name = clear($_POST['item_name']);
- $stack_height = clear($_POST['stack_height']);
- $can_stack = clear($_POST['can_stack']);
- $id = $_GET['id'];
- mysql_query("UPDATE furniture SET public_name='$public_name', stack_height='$stack_height', item_name='$item_name', can_stack='$can_stack' WHERE id='$id'");
- mysql_close();
- echo 'stack_height Edited.';
- }
- else
- {
- $id = $_GET['id'];
- $query = mysql_query("SELECT * FROM stack_height WHERE id='$id'");
- $output = mysql_fetch_assoc($query);
- ?>
- <form method="post" action="?id=<? echo $output['id']; ?>">
- Editing <? echo $output['item_name']; ?><hr />
- public_name:<input name="public_name" id="public_name" type="Text" size="50" maxlength="50" value="<? echo $output['public_name']; ?>"><br />
- item_name:<input name="item_name" id="item_name" type="Text" size="50" maxlength="50" value="<? echo $output['item_name']; ?>"><br />
- stack_height:<input name="stack_height" id="stack_height" type="Text" size="50" maxlength="50" value="<? echo $output['stack_height']; ?>"><br />
- can_stack:<input name="can_stack" id="can_stack" type="Text" size="50" maxlength="50" value="<? echo $output['can_stack']; ?>"><br />
- <input type="Submit" name="submit" value="Enter information">
- </form>
- <?php }} ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement