ERROR:INSERT INTO issues (title,catid,pid,desc,date) VALUES ('Online Selling System','1','2','How to create cart?',NOW()).You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,date) VALUES ('Online Selling System','1','2','How to create cart?',NOW())' at line 1
aku dapat error macam kat atas tu...ni coding aku...dah tak larat daa
- Code:
<?php
if(isset($_POST['submit']))
{
//check form input for errors
//check title
if(trim($_POST['title'])=='')
{
die('ERROR:Please enter title');
}
mysql_connect("localhost","root","") or die (mysql_error());
mysql_select_db("system") or die (mysql_error());
//generate and execute query to insert question
$query="INSERT INTO issues (title,catid,pid,desc,date) VALUES ('{$_POST['title']}','{$_POST['catid']}','{$_POST['pid']}','{$_POST['desc']}',NOW())";
$result=mysql_query($query)or die("ERROR:$query.".mysql_error());
//print success message
echo "Issues successfully added to the database! Click <a href='view.php>here</a> to view page";
}
else
{
die('ERROR:Data not correctly submitted');
}
?>