Page 1 of 1

mySQL INSERT playing up...

Posted: Sat Jun 03, 2006 11:14 am
by tommy1987
Can anyone spot what is wrong here, tried for too long.... :(

Im trying to insert the variables: $fromconf, $contentconf and the text value "Unread". Its not inserting at all, however, I have an if($result) { echo 'Success!'; } and its displaying the success message which is confusing.

e.g. of what $table equals:

$table = "PM_Tom";

Code: Select all

$query = "INSERT INTO $table (Date, From, Content, ReadUnread) VALUES (now(), '$fromconf', '$contentconf', 'Unread')";
$result = mysql_query($query);
Hope someone can help,, Thanks, Tom

Posted: Sat Jun 03, 2006 11:18 am
by NiGHTFiRE

Code: Select all

$query = "INSERT INTO $table (Date, From, Content, ReadUnread) VALUES (now(), '$fromconf', '$contentconf', 'Unread')"; 
$result = mysql_query($query) or die(mysql_error());

Posted: Sat Jun 03, 2006 2:26 pm
by ok

Code: Select all

$query = "INSERT INTO ".$table." (`Date`, `From`, `Content`, `ReadUnread`) VALUES ('".now()."', '".$fromconf."', '".$contentconf."', 'Unread')";
$result = mysql_query($query) or die(mysql_error());