View Single Post
  #1 (permalink)  
Old May 23rd, 2004, 05:52 AM
vkranendonk vkranendonk is offline
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 6, page 173-175, error in sql syntax

Hello,

On chapter 6, page 173-175 I get an error in my mysql syntax. I don't know whats wrong with it I have tried several things.

I hope somebody can help me.

This is the error that is displayed.

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 ') VALUES ( 'Vincent,' , '2002' , '3' , '3' ,

This is the text file:

<?php
//************************************************** ************************************************** ********
//commit add
//************************************************** ************************************************** ********
  $link = mysql_connect("localhost", "root", "kranendonk") or die(mysql_error());
  $select = mysql_select_db("wiley", $link) or die(mysql_error());
  switch( $_GET['action'] ){
    case "add":
  switch( $_GET['type'] ){
    case "movie":
  $sql = "INSERT INTO
      `movie`
    ( `movie_name`,
      `movie_year`,
      `movie_type`,
        `movie_leadactor`,
      `movie_director`,)
      VALUES
    ( '".$_POST['movie_name'].",' ,
      '".$_POST['movie_year']."' ,
      '".$_POST['movie_type']."' ,
      '".$_POST['movie_leadactor']."' ,
      '".$_POST['movie_director']."' )
      ";
    break;
  }
    break;
}
if ( isset( $sql ) && !empty( $sql )){
  echo "<!-".$sql."->";
  $result = mysql_query( $sql ) or die(mysql_error());
?>
  <p align="center" style="color:#FF0000">
    Done. <a href="index.php">Index</a>
  </p>
<?php
  }
?>

If somebody could help me i will be verry happy.

Reply With Quote