Jump to content

[SOLVED] SQL Syntax Error


andrew6607

Recommended Posts

Hello,

 

I have been Spending Almost A Hour Trying to Figure This Out. I have solved it before but i cant figure out how i did it. Please HELP!! Here is the error it gives:

 

MySQL Said: 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 '*INTO new_members ( fname, lname, email, username, password ) values( 'Andre' at line 1

 

Now Here Is The PHP CODE:

 

<?php

include( 'includes/config.php' );
//Get Data From Forum
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$cpassword = $_POST['cpassword'];

//Validate Info

if( $fname == false || $lname == false || $email == false || $username == false || $password == false ) {
echo "Please Fill Out All The Feilds!!";
}

if( $password == $cpassword ) {
$link = mysql_connect( $db_host, $db_username, $db_password );
   if( ! $link ) {
    die ( "MySQL Said: ".mysql_error() );
}
$db = mysql_select_db( $db_database, $link );
  if( ! $db ) {
   die ("MySQL Said: ".mysql_error() );
   }
$query = "INSERT *INTO new_members ( fname, lname, email, username, password )
   values( '$fname', '$lname', '$email', '$username', '$password' )";
mysql_query( $query, $link )
  or die ( "MySQL Said: ".mysql_error() );
  
mysql_close( $link );
}else{
echo "Your Passwords Dont Match";
} 
?>

 

Thanks!!

 

Andrew E

Link to comment
https://forums.phpfreaks.com/topic/88863-solved-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.