Hallo!
ich habe ein Anmeldeformular gebaut. Doch irgendwie funktioniert es nicht! Frage steht ganz unten. danke im voraus
der code des hauptanmeldeformulars:
ich weiß es nicht warum.. die mysql-datenbank ist eigentlich auch korrekt.
dann habe ich noch das fomularblatt schlechthin, wo ich daten eingebe:
und dann der action-script:
da kommt dann aber folgende Fehlermeldung, wenn ich etwas eintragen will:
, wenn ich für altersklasse "class" eingebe und für mail-adresse "mail".....
Kann mir jemand helfen?
danke.. Carlo
ich habe ein Anmeldeformular gebaut. Doch irgendwie funktioniert es nicht! Frage steht ganz unten. danke im voraus
der code des hauptanmeldeformulars:
Code:
<?php include("inc/phphead.php"); ?> <?php include("inc/config.php"); ?> <div> Eintrag hinzufügen <table border="1"> <tr> <th>Nachname</th> <th>Vorname</th> <th>Alter</th> <th>Verein</th> <th>Altersklasse</th> </tr> <?php $dbLink=mysql_connect($server, $user, $password) or die("Keine Verbindung möglich: " . mysql_error()); mysql_select_db($database, $dbLink) or die("Auswahl der birthdaynbank fehlgeschlagen"); if(!isset($_REQUEST['resultPageNo'])) { $resultPageNo=0; } else { $resultPageNo=$_REQUEST['resultPageNo']; } $query = "SELECT * FROM tb_anmeldung ORDER BY rider_id DESC"; $resultSet=mysql_query($query, $dbLink) or die("Anfrage fehlgeschlagen: " . mysql_error()); $colLength=mysql_num_rows(mysql_query("SELECT * FROM tb_anmeldung ORDER BY rider_id DESC", $dbLink)); for($i=0; $i<mysql_num_rows($resultSet); $i++) { $curRow=mysql_fetch_object($resultSet); ?> <tr> <td><?php echo $curRow->firstname ?></td> <td><?php echo $curRow->lastname ?></td> <td><?php echo $curRow->birthday ?></td> <td><?php echo $curRow->profession ?></td> <td><?php echo $curRow->class ?></td> <td> löschen bearbeiten </td> </tr> <?php }?> </table> <?php if($colLength>$resultsPerPage) { $Seiten=intval($colLength/$resultsPerPage); if($colLength%$resultsPerPage) { $Seiten++; } echo"Seite "; } for($i=1; $i<=$Seiten; $i++) { echo"<a href=\"anmeldungAdministration.php?resultPageNo=",($i-1)*$resultsPerPage,"\">$i</a>"; } ?> Eintrag hinzufügen </div>
dann habe ich noch das fomularblatt schlechthin, wo ich daten eingebe:
Code:
<?php include("inc/phphead.php"); ?> <?php include("inc/config.php"); ?> <?php $firstname=""; $lastname=""; $birthday="1900-01-01"; $class=""; $team=""; $mail=""; $rider_id=""; $mode = "insert"; if(isset($_REQUEST['rider_id']) ) { $dbLink=mysql_connect($server, $user, $password) or die("Keine Verbindung möglich: " . mysql_error()); mysql_select_db($database, $dbLink) or die("Auswahl der Datenbank fehlgeschlagen"); $rider_id=$_REQUEST['rider_id']; $query = "SELECT * FROM tb_anmeldung WHERE rider_id = $rider_id"; $resultSet=mysql_query($query, $dbLink) or die("Anfrage fehlgeschlagen: " . mysql_error()); $curRow=mysql_fetch_object($resultSet); $firstname =$curRow->firstname; $lastname =$curRow->lastname; $birthday =$curRow->birthday; $class =$curRow->class; $team =$curRow->team; $mail =$mail->mail; $mode ="update"; } ?> <div> <form action="anmeldungAction.php" method="post"> <table border="0"> <tr> <td>Vorname:</td> <td><input name="firstname" maxlength="50" type="text" value="<?php echo $firstname; ?>"></td> </tr> <tr> <td>Nachname:</td> <td><input maxlength="40" name="lastname" type="text" value="<?php echo $lastname; ?>"></td> </tr> <tr> <td> Geburtstag: (Jahr-Monat-Tag) </td> <td> <input maxlength="40" name="birthday" type="text" value="<?php echo $birthday; ?>"> </td> </tr> <tr> <td>Team</td> <td><input name="team" maxlength="100" type="text" value="<?php echo $team; ?>"></td> </tr> <tr> <td>Mail</td> <td><input maxlength="40" name="mail" type="text" value="<?php echo $mail; ?>"></td> </tr> <tr> <td>Altersklasse</td> <td><input maxlength="40" name="class" type="text" value="<?php echo $class; ?>"></td> </tr> <tr> <td align="center" colspan="2"> <input name="mode" type="hidden" value="<?php echo $mode; ?>"> <input name="rider_id" type="hidden" value="<?php echo $rider_id; ?>"> <input name="Send" type="submit" value="Eintragen"> <input name="Reset" type="reset" value="Reset"> </td> </tr> </table> </form> </div> <?php include("inc/phpfoot.php"); ?>
Code:
<?php include("inc/phphead.php"); ?> <?php include("inc/config.php"); ?> <div> <?php $firstname=$_REQUEST['firstname']; $lastname=$_REQUEST['lastname']; $class=$_REQUEST['class']; $mail=$_REQUEST['mail']; $rider_id=$_REQUEST['rider_id']; $team=$_REQUEST['team']; $bithday=$_REQUEST['birthday']; if ($_REQUEST['mode']=='delete'){ $query = "DELETE FROM tb_anmeldung WHERE rider_id = $rider_id"; } if ($_POST['mode']=='update'){ $query = "UPDATE tb_anmeldung SET firstname='$firstname', lastname='$lastname', birthday='$birthday', class='$class', team='$team', mail='$mail' WHERE rider_id = $rider_id"; } if ($_REQUEST['mode']=='insert') { $query = "INSERT INTO tb_anmeldung (birthday, firstname, lastname, team, class, mail) VALUES ('$birthday', '$firstname', '$lastname', '$team, '$class', '$mail')"; } //echo $query; $dbLink=mysql_connect($server, $user, $password) or die("Keine Verbindung möglich: " . mysql_error()); mysql_select_db($database, $dbLink) or die("Auswahl der Datenbank fehlgeschlagen"); mysql_query($query, $dbLink) or die("Anfrage fehlgeschlagen: " . mysql_error()); if(mysql_affected_rows($dbLink)==1) { ?> Daten wurden erfolgreich geändert! Zurück <?php } else { ?> Beim Eintragen ist ein Fehler aufgetreten. Zurück <?php } ?> </div> <?php include("../inc/phpfoot.php"); ?>
Anfrage fehlgeschlagen: 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 'class', 'mail')' at line 1
Kann mir jemand helfen?
danke.. Carlo
Kommentar