Jump to content

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

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.