Jump to content

[SOLVED] sql error


proctk

Recommended Posts

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;
}

?> 

Link to comment
Share on other sites

I'm not sure what you are refering to

 

here is the table structure

 

albumNames  CREATE TABLE `albumNames` (                       

              `id` int(10) NOT NULL auto_increment,           

              `user_id` int(10) NOT NULL,                     

              `name` varchar(50) NOT NULL,                     

              `location` varchar(50) NOT NULL,                 

              `desc` text NOT NULL,                           

              `createdate` date NOT NULL default '0000-00-00', 

              PRIMARY KEY  (`id`)                             

            ) ENGINE=MyISAM DEFAULT CHARSET=latin1             

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.