Bnaya

PHP mysql inset

Dec 2nd, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2. // Simple clean insert
  3. $sql = 'INSERT INTO `posts` (`title`, `content`) VALUES ("' . mysql_real_escape_string($_POST['post_title']) .'", "' . mysql_real_escape_string($_POST['post_content']) .'")';
  4. if (!mysql_query($sql)) {
  5.     error_log('oops in sql query:' . mysql_error() . ' | the query was:' . $sql);
  6. }
  7. ?>
  8.  
  9. // Simple output
  10. <input type="post_title" name="title" value="<?php echo htmlspecialchars($postRow['post_title']); ?>">
  11. <textarea name="post_content"><?php echo htmlspecialchars($postRow['post_content']); ?></textarea>
Advertisement
Add Comment
Please, Sign In to add comment