2017-12-09 7 views
-1
<?php 
require '../../config.php'; 
if(isset($_POST['account_type']) && $_POST['account_type'] == 1) 
{ 
$account_type = $_POST['account_type']; 
$s_name_scoach = $_POST['s_name_scoach']; 
$s_phone_coach = $_POST['s_phone_coach']; 
$s_email_coach = $_POST['s_email_coach']; 
$s_password_coach = encryptIt(mysqli_real_escape_string($statcash,$_POST['s_password_coach'])); 
$s_nameSchool_coach = mysqli_real_escape_string($statcash,$_POST['s_nameSchool_coach']); 
$s_addSchool_coach = mysqli_real_escape_string($statcash,$_POST['s_addSchool_coach']); 
$s_phoneSchool_coach = $_POST['s_phoneSchool_coach']; 

Erste Fehlermeldung:
Sie haben einen Fehler in Ihrer SQL-Syntax; Sie in die Bedienungsanleitung zu Ihrer MySQL-Server-Version für die richtige Syntax entspricht in der Nähe zu verwenden ‚‘‘in Zeile 10SQL-Fehler - gibt Fehler bei der Einreichung - php

<?php 
require '../../config.php'; 
if(isset($_POST['account_type']) && $_POST['account_type'] == 1) 
{ 
$account_type = $_POST['account_type']; 
$s_name_scoach = $_POST['s_name_scoach']; 
$s_phone_coach = $_POST['s_phone_coach']; 
$s_email_coach = $_POST['s_email_coach']; 
$s_password_coach = encryptIt(mysqli_real_escape_string($statcash,$_POST ['s_password_coach'])); 
$s_nameSchool_coach = mysqli_real_escape_string($statcash,$_POST['s_nameSchool_coach']); 
$s_addSchool_coach = mysqli_real_escape_string($statcash,$_POST['s_addSchool_coach']); 
$s_phoneSchool_coach = $_POST['s_phoneSchool_coach']; 


$check_email = $statcash->query("SELECT * FROM users WHERE 
email = '".$s_email_coach."' AND account_type = '".$account_type."' 
"); 

if($check_email->num_rows > 0) 
{ 
echo "Email Address Already Exists!"; 
} 
else 
{ 
$add_users = $statcash->query("INSERT INTO users SET 
account_type = '".$account_type."', 
name = '".$s_name_scoach."', 
phone = '".$s_phone_coach."', 
email = '".$s_email_coach."', 
password = '".$s_password_coach."', 
school_name = '".$s_nameSchool_coach."', 
school_address = '".$s_addSchool_coach."', 
school_phone = '".$s_phoneSchool_coach."', 
' 
"); 

if($add_users) 
{?> 
<script> 
document.location = "../index.php"; 
</script> 
<?php 
} 
else 
{ 
echo mysqli_error($statcash); 
} 
} 
} 
else if(isset($_POST['account_type']) && $_POST['account_type'] == 2) 
{ 
$account_type = $_POST['account_type']; 
$s_name_scoach = $_POST['s_name_scoach']; 
$s_phone_coach = $_POST['s_phone_coach']; 
$s_email_coach = $_POST['s_email_coach']; 
$s_password_coach = encryptIt(mysqli_real_escape_string($statcash,$_POST['s_password_coach'])); 
$s_nameSchool_coach = mysqli_real_escape_string($statcash,$_POST['s_nameSchool_coach']); 
$s_addSchool_coach = mysqli_real_escape_string($statcash,$_POST['s_addSchool_coach']); 
$s_phoneSchool_coach = $_POST['s_phoneSchool_coach']; 

$check_email = $statcash->query("SELECT * FROM users WHERE 
email = '".$s_email_coach."' AND account_type = '".$account_type."' 
"); 

if($check_email->num_rows > 0) 
{ 
echo "Email Address Already Exists!"; 
} 
else 
    { 
     $add_users = $statcash->query("INSERT INTO users SET 
      account_type = '".$account_type."', 
      name = '".$s_name_scoach."', 
      phone = '".$s_phone_coach."', 
      email = '".$s_email_coach."', 
      password = '".$s_password_coach."', 
      school_name = '".$s_nameSchool_coach."', 
      school_address = '".$s_addSchool_coach."', 
      school_phone = '".$s_phoneSchool_coach."', 

     "); 

     if($add_users) 
     {?> 
      <script> 
       document.location = "../index.php"; 
      </script> 
     <?php 
     } 
     else 
     { 
      echo mysqli_error($statcash); 
     } 
    } 
} 
else if(isset($_POST['account_type']) && $_POST['account_type'] == 3) 
{ 
    $account_type = $_POST['account_type']; 
    $s_name_scoach = $_POST['ass_coach_name']; 
    $s_email_coach = $_POST['ass_coach_email']; 

    $s_password_coach = encryptIt(mysqli_real_escape_string($statcash,$_POST['ass_coach_password'])); 

    $check_email = $statcash->query("SELECT * FROM users WHERE 
     email = '".$s_email_coach."' AND account_type = '".$account_type."' 
    "); 

    if($check_email->num_rows > 0) 
    { 
     echo "Email Address Already Exists!"; 
    } 
    else 
    { 
     $add_users = $statcash->query("INSERT INTO users SET 
      account_type = '".$account_type."', 
      name = '".$s_name_scoach."', 
      email = '".$s_email_coach."', 
      password = '".$s_password_coach."' 
     "); 

     if($add_users) 
     {?> 
      <script> 
       document.location = "../index.php"; 
      </script> 
     <?php 
     } 
     else 
     { 
      echo mysqli_error($statcash); 
     } 
    } 
} 
else if(isset($_POST['account_type']) && $_POST['account_type'] == 4) 
{ 
    $account_type = $_POST['account_type']; 
    $s_name_scoach = $_POST['ass_coach_name']; 
    $s_email_coach = $_POST['ass_coach_email']; 
    $ass_coach_phone = $_POST['ass_coach_phone']; 
    $s_password_coach = encryptIt(mysqli_real_escape_string($statcash,$_POST['ass_coach_password'])); 

    $check_email = $statcash->query("SELECT * FROM users WHERE 
     email = '".$s_email_coach."' AND account_type = '".$account_type."' 
    "); 

    if($check_email->num_rows > 0) 
    { 
     echo "Email Address Already Exists!"; 
    } 
    else 
    { 
     $add_users = $statcash->query("INSERT INTO users SET 
      account_type = '".$account_type."', 
      name = '".$s_name_scoach."', 
      email = '".$s_email_coach."', 
      phone = '".$ass_coach_phone."', 
      password = '".$s_password_coach."' 
     "); 

     if($add_users) 
     {?> 
      <script> 
       document.location = "../index.php"; 
      </script> 
     <?php 
     } 
     else 
     { 
      echo mysqli_error($statcash); 
     } 
    } 
} 
else 
{ 
    echo "You Must Submit Form for Registration!"; 
} 

?>

Enthalten diese Abdeckung, was Sie brauchen? Ich kann am Ende den Rest einfügen, wenn Sie mehr brauchen. Aber ich würde eher auf einen Minimal- halten es, wie ich bin sicher, dass Sie das auch schätzen würde ..

+3

Sie müssen die 'sql' löschen und hier posten, um zu überprüfen, –

+0

in Ordnung, so bin ich neu in der Sprache, du wirst das erklären müssen. –

+0

Sie haben einen Fehler in Ihrem SQL - aber Sie haben den SQL-Code nicht angezeigt. Kannst du es bitte zeigen? – TimBrownlaw

Antwort

-1

Gelöschte die nach school_phone = ‚‚ $ s_phoneSchool_coach.‘‘

in der andere Aussage.

Verwandte Themen