I've tried creating a Message table, and I've tested all my variables without the MYSQL_QUERY to make sure the information came over from the the HTML form on the previous PHP page, and they all work.
I've googled the INSERT INTO command example several times to make sure the code is corret and it is. Not to mention I have a register page set up to the same database, different table that works fine.
I've also downloaded a free script to use as a guide, and it came with a MYSQL table, which was set up and is INSERTing messages properly, so I don't understand what else could be wrong with my code???
Here is my PHP code on the page that is not working. I get the Die message no matter what I try.
<?php
include "connect.php";
session_start();
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
$enemy=$_GET['playername'];
$message=strip_tags(addslashes($_POST['message']));
$timestamp=strftime("%Y-%m-%d %T");
$type="1";
$sql="INSERT INTO war_messages ('id', 'sent', 'type', 'messages', 'from', 'to') VALUES (NULL, '$timestamp', '$type', '$message', '$player', '$enemy')";
mysql_query($sql) or die("Could Not Send Mail");
}
?>
This is the war_messages table.
Field Type Collation Attributes Null Default Extra Action
id int(100) No auto_increment
sent datetime No
type int(1) No
messages mediumtext latin1_swedish_ci No
from varchar(30) latin1_swedish_ci No
to varchar(30) latin1_swedish_ci No
This is the HTML form on the previous page.
<center><form name='message' method='post' action='message2.php?playername=$enemy'>
<br>
Send a Message to $enemy
<br>
<br>
<br>
<textarea cols='80' rows='10' wrap='hard' name='message'></textarea>
<br>
<br>
<br>
<input type='submit' name='submit' value='Send'></form></center>
Am I possibly using protected words from MYSQL or PHP that I need to change?
Thank You in advance for any help or suggestions. Please let me know if you need any other code to help me with this problem.