Jump to content

Strange INSERT problem


son.of.the.morning

Recommended Posts

I have done a simple insert query on a comment system but it works once and when i go back and try add another record it just doesnt work at all.

 

<?php 

include ("class.database.connection.php");   // the database connection class
include ("settings.config.php");  // hostname, password ect

$name = $_POST["UserName"];
$email = $_POST["UserEmail"];
$comment = $_POST["UserComment"];

$sql="INSERT INTO comments (name, email, comment)VALUES('$name', '$email', '$comment')";
$result=mysql_query($sql);


?>

 

if anyone can help me with this i would be a happy chappy!

Link to comment
https://forums.phpfreaks.com/topic/251808-strange-insert-problem/
Share on other sites

yea well i have applied that within my datavase connection class

 

public function databaseConnection($objDatabaseConnect)
        {
            $this->_database_connection =
            mysql_pconnect($this->hostname,
                           $this->username,
                           $this->password)
            or trigger_error(mysql_error(),E_USER_ERROR);
            return $this->_database_connection;
        }

Just tryied it still nothing it's driving me insane!!

 

http://dvplus.webuda.com/oophptest/database.query.php  This sis it up and running, i have set the post page just as blank i just wana make sure that the data it getting into the database first.

Oddly enough, when I try to use the form I get this:

 

Query string: INSERT INTO comments (name, email, comment)VALUES('bob', '[email protected]', 'WTF?')
Produced error: Duplicate entry '0000-00-00 00:00:00' for key 'datatime'

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.