Insert the transmitted data in table vocabulary ERROR: empty contents"; goto goBack; } // // establish the DB connection MYSQL_CONNECT($server, $user, $passwort) or die("

Cannot reach database server

"); $msg = "

Datenbank "; $msg = $msg + $datenbank; $msg = $msg + " cannot be reached

"; // // select the database MYSQL_SELECT_DB($datenbank) or die($msg); // // avoid doubles $result = MYSQL_QUERY( "SELECT * FROM Vokabeln WHERE wort1='$WO1' AND wort2='$WO2'"); $noHits = mysql_num_rows($result); if ($noHits > 0) { MYSQL_CLOSE(); echo "

Double entry: $WO1 = $WO2

"; goto goBack; } // this is a new record (not a double) // get the ID of the next free record $result = MYSQL_QUERY( "SELECT MAX(ID) FROM " . $tabelle); while($row = mysql_fetch_row($result)) { for($i = 0; $i < mysql_num_fields($result); $i++) { $ID = $row[$i]; } } $ID = $ID + 1; echo "

ID=$ID

"; $result = MYSQL_QUERY( "UPDATE " . $tabelle ." SET id=$ID WHERE wort1='0' AND wort2='0'"); echo "

result UPDATE=$result

"; // if (strlen($WO1) > 0) { $WO1 = trim($WO1); } if (strlen($WO2) > 0) { $WO2 = trim($WO2); } if (strlen($SPR) > 0) { $SPR = trim($SPR); } if (strlen($SONST) > 0) { $SONST = trim($SONST); } // insert the record $result = MYSQL_QUERY( "INSERT INTO $tabelle VALUES('$WO1', '$WO2', '$SPR', '$SONST', $ID)"); echo "

result INSERT =$result

"; // // show the number of records in the table $anzahl = MYSQL_NUMROWS(MYSQL_QUERY( "SELECT * FROM $tabelle")); if ($anzahl == 0): echo "No data found"; elseif ($anzahl > 0): echo "$anzahl records found"; endif; // MYSQL_CLOSE(); echo "

Insert OK in table $tabelle ID=$ID (MySql V5)

"; goBack: ; ?>