Entering Content Into A MySQL Database Via A Form

Posted by ThatMacLad on Stack Overflow See other posts from Stack Overflow or by ThatMacLad
Published on 2010-04-27T16:37:33Z Indexed on 2010/04/27 16:43 UTC
Read the original article Hit count: 183

Filed under:
|
|

I've been working on creating a form that submits content into my database but I decided that rather than using a drop down menu to select the date I'd rather use a textfield. I was wondering what changes I will need to make to my table creation file.

<?php mysql_connect ('localhost', 'root', 'root') ;
mysql_select_db ('tmlblog');

$sql = "CREATE TABLE php_blog (
  id int(20) NOT NULL auto_increment,
  timestamp int(20) NOT NULL,
  title varchar(255) NOT NULL,
  entry longtext NOT NULL,
  PRIMARY KEY  (id)
)";

$result = mysql_query($sql) or print ("Can't create the table 'php_blog' in the database.<br />" . $sql . "<br />" . mysql_error());

mysql_close();
if ($result != false) {
    echo "Table 'php_blog' was successfully created.";
}
?>

It's the timestamp that I need to edit to enter in via a textfield. The Title and Entry are currently being entered via that method anyway.

© Stack Overflow or respective owner

Related posts about mysql-query

Related posts about php