sql problem

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • sql problem

    PHP-Code:
    <?

    include 'settings.php';

    // Define post fields into simple variables
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $username = $_POST['username'];
    $email_address = $_POST['email_address'];
    $adress = $_POST['adress'];
    $birthday = $_POST['birthday'];
    $phone = $_POST['phone'];
    $mobile = $_POST['mobile'];
    $abi1 = $_POST['abi1'];
    $abi2 = $_POST['abi2'];
    $abi3 = $_POST['literatur'];
    $info = $_POST['info'];


    /* Let's strip some slashes in case the user entered
    any escaped characters. */

    $first_name = stripslashes($first_name);
    $last_name = stripslashes($last_name);
    $spitzname = stripslashes($spitzname);
    $email_address = stripslashes($email_address);
    $adress = stripslashes($adress);
    $birthday = stripslashes($birthday);
    $phone = stripslashes($phone);
    $mobile = stripslashes($mobile);
    $abi1 = stripslashes($abi1);
    $abi2 = stripslashes($abi2);
    $literatur = stripslashes($literatur);
    $info = stripslashes($info);


    /* Do some error checking on the form posted fields */

    if((!$first_name) || (!$last_name) || (!$email_address) || (!$spitzname)){
        echo 'Sie müssen folfende Felder ausfüllen: <br />';
        if(!$first_name){
            echo "Bitte füllen Sie das Feld <strong>Vorname</strong> korrekt aus.<br />";
        }
        if(!$last_name){
            echo "Bitte füllen Sie das Feld <strong>Nachname</strong> korrekt aus.<br />";
        }
            include 'join_form.html'; // Show the form again!
    }
    // Enter info into the Database.
    $info2 = htmlspecialchars($info);
    $sql = mysql_query("INSERT INTO lampen_user (first_name, last_name, email_address, spitzname, password, info, adress, birthday, phone, mobile, abi1, abi2, literatur, info, )
            VALUES('$first_name', '$last_name', '$email_address', '$spitzname' , '$info' , '$adress' , '$birthday', '$phone' ,'$mobile' , '$abi1', '$abi2', '$literatur', '$info2', )") 
            or die (mysql_error());
    if(!$sql){  
        echo 'Es gab einen Fehler beim eintragen der Schülerdaten';   // für diese line gibt der parse error

    ?>

    bekomm parse error für die markierte line!!
    bin ich mal wieder blind oder woran liegt es ?



    danke
    thx Mukraker

  • #2
    sorry, war Müll
    TBT

    Die zwei wichtigsten Regeln für eine berufliche Karriere:
    1. Verrate niemals alles was du weißt!


    PHP 2 AllPatrizier II Browsergame

    Kommentar


    • #3
      der fehler kommt, wenn die mysql-query nicht korrekt ist.

      du hast bei den angaben der feldnamen am ende ein komma zu viel.
      auch bei den inhalten ist ein komma zu viel.

      hier die korrektur...

      PHP-Code:
      $sql mysql_query("INSERT INTO lampen_user (first_name, last_name, email_address, spitzname, password, info, adress, birthday, phone, mobile, abi1, abi2, literatur, info)
              VALUES('
      $first_name', '$last_name', '$email_address', '$spitzname' , '$info' , '$adress' , '$birthday', '$phone' ,'$mobile' , '$abi1', '$abi2', '$literatur', '$info2')"
              or die (
      mysql_error()); 
      INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


      Kommentar

      Lädt...
      X