Code: Select all
<?
$ctitle = $_POST['subject'];
$cbody = $_POST['comment'];
$com_id = $_GET['cid'];
$cdate = date("D, M j");
$cauthor = $_GET['cauthor'];
include "config.php";
$connection=mysql_connect($location, $dbuname, $dbpass) or die("Unable to establish a connection to $location");
mysql_select_db($db, $connection) or die("Unable to select the database ");
$query="INSERT into articles_comments(ctitle, cauthor, cdate, cbody, com_id) values ($ctitle, $cauthor, $cdate, $cbody, $com_id)";
mysql_query($query,$connection) or die("Unable to run query: $query.");
mysql_close($connection);
?>i made sure all the variables contain some information, and dont need any help with that, just how to use the basic INSERT command with variables, which right now seems VERY hard
I get this error every time, even when i take out each variable one at a time to decifer which one is messing the result up:
Code: Select all
Unable to run query: INSERT into articles_comments(ctitle, cauthor, cdate, cbody, com_id) values (sub, theAUTHOR, Tue, May 13, com, 3).sorry if this is posted in the wrong place or has already been answered...i'm so frustrated and guess i'm not thinking straight.
Thanks in advance!
-Mike
?>