Jump to content

[SOLVED] Another SQL syntax Error!!


andrew6607

Recommended Posts

PHP Version: 5

Mysql Version 5

 

Error: INSERT error: 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 ' , , , , , )' at line 2

 

Here is the code im using.

<?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$positon = $_POST['positon'];
$exp = $_POST['exp'];
$username = $_POST['username'];
$password = $_POST['password'];
$user = "root";
$pass = "##########";
$db = "#########";
$table = "#########";
$link = mysql_connect( "localhost", $user, $pass );
if ( ! $link ) {
  die( "Couldn't connect to the MySQL Server: ".mysql_error() );
}

mysql_select_db( $db )
  or die ( "Couldn't open $db: ".mysql_error() );
  
  
$query = "INSERT INTO staff( fname, lname, email, positon, exp, username, password )
   values( $fname, $lname, $email, $positon, $exp, $username, $password )"; 
   mysql_query( $query, $link )
     or die ( "INSERT error: ".mysql_error() );

mysql_close( $link );
?>

Link to comment
https://forums.phpfreaks.com/topic/82097-solved-another-sql-syntax-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.