Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Upload</title>
- </head>
- <body>
- <form action="action.php" method="post">
- <fieldset class="first">
- Name:
- <input type="text" name="author" />
- Heading:
- <input type="text" name="heading" />
- Text:
- <textarea type="text" name="thecontent"> </textarea>
- </fieldset>
- <fieldset>
- <input type="submit"/>
- </fieldset>
- </form>
- </body>
- </html>
- <html>
- <head>
- <title>Send!</title>
- </head>
- <body>
- <?php
- ini_set('display_errors', 1); error_reporting(E_ALL);
- $link = mysql_connect('localhost','name','pasword')
- or die ("Unable to connect");
- $mydb = mysql_select_db('the_database',$link)
- or die ("No database found");
- $author = $_POST['author'];
- $heading = $_POST['heading'];
- $thecontent = $_POST['thecontent'];
- $mysql_query="INSERT INTO articles ('heading', 'author', 'content')
- VALUES ('$heading','$author','$thecontent')" or die(mysql_error());
- echo "This was send: $author $heading $thecontent <br> ";
- mysql_close()
- ?>
- </body>
- </html>
- <html>
- <head>
- <title>Send!</title>
- </head>
- <body>
- <?php
- ini_set('display_errors', 1); error_reporting(E_ALL);
- $DB_HOST = 'localhost';
- $DB_USER = '**';
- $DB_PASS = '***';
- $DB_NAME = '***';
- @ $db = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
- if (mysqli_connect_errno()) {
- echo 'Error.';
- exit();
- }
- $author = $_POST['author'];
- $heading = $_POST['heading'];
- $thecontent = $_POST['thecontent'];
- $query = 'INSERT INTO articles ('heading', 'author', 'content')
- VALUES ('$heading','$author','$thecontent')';
- $result = $db->query($query);
- if ($result) {
- echo $db->affected_rows."This was added.";
- }
- else {
- echo "somethings gone very wrong.";
- }
- $db->close();
- ?>
- </body>
- </html>
- $mysql_query="INSERT INTO articles ('heading', 'author', 'content')
- VALUES ('$heading','$author','$thecontent')";
- mysql_query($mysql_query);
- //required to run the query..
- And mysql_close(); // missing :p
Add Comment
Please, Sign In to add comment