kproc
07-14-2007, 02:17 PM
Hi the below code is giving me this error and I cannot figure out why
SQL Error: INSERT INTO albumNames (user_id, name, location, desc, createdate) VALUES('63', 'Family Tip', 'mjljo', 'ln', 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, createdate) VALUES('63', 'Family Tip', 'mjljo', 'ln', now(
and ideas by
if(isset($_POST['create_album'])){
$location = $_POST['location'];
$name = $_POST['name'];
$desc = $_POST['desc'];
$user_id = $_SESSION['user_id'];
if(!$name){
$msg .= "You must enter an Album Name<br />";
header("location: $url?msg=$msg");
exit();
}
$query_create_album = ("INSERT INTO albumNames (user_id, name, location, desc, createdate)
VALUES('$user_id', '$name', '$location', '$desc', now())");
$sql = mysql_query($query_create_album)or die("SQL Error: $query_create_album<br>" . mysql_error());
$msg .= "New Photo Album has been created";
header("location: $url?msg=$msg");
exit;
}
?>
SQL Error: INSERT INTO albumNames (user_id, name, location, desc, createdate) VALUES('63', 'Family Tip', 'mjljo', 'ln', 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, createdate) VALUES('63', 'Family Tip', 'mjljo', 'ln', now(
and ideas by
if(isset($_POST['create_album'])){
$location = $_POST['location'];
$name = $_POST['name'];
$desc = $_POST['desc'];
$user_id = $_SESSION['user_id'];
if(!$name){
$msg .= "You must enter an Album Name<br />";
header("location: $url?msg=$msg");
exit();
}
$query_create_album = ("INSERT INTO albumNames (user_id, name, location, desc, createdate)
VALUES('$user_id', '$name', '$location', '$desc', now())");
$sql = mysql_query($query_create_album)or die("SQL Error: $query_create_album<br>" . mysql_error());
$msg .= "New Photo Album has been created";
header("location: $url?msg=$msg");
exit;
}
?>