ThomasX: Kein eintrag in die Datenbank

Beitrag lesen

Hallo,
ich habe ein Problem mit einem PHP Script
schaut euch mal den Code an (der bereich, in dem ich den fehler vermute ist markiert, habe aber den ganzen code hin, weil er auch wo anders liegen könnte.)

<?php
require("../include/config.php");
require("../include/db_config.php");
$connection = mysql_connect("$dbhost", "$dbuser", "$dbpwd");
 if(!$connection) die("<b>Fehler auf der Seite: Es konnte keine Verbindung zur Datenbank hergestellt werden!</b>");
 if(! mysql_select_db("$dbname", $connection) ) die("<b>Fehler auf der Seite: Datenbank konnte nicht ausgewählt werden!</b>");

------------ hier liegt eventuell der Fehler: ------------

if(isset($submit))
{
 function insert_it($num)
 {
  mysql_query("INSERT pk_at_data (at_name, at_wirk, at_work_typ, at_typ, at_ap, at_sp, at_genau, at_tm, at_vm, at_tvm_find) VALUES ('$at_name_$num','$at_wirk_$num','$at_wirk_typ_$num','$at_typ_$num','$at_ap_$num','$at_sp_$num','$at_genau_$num','$at_tm_$num','$at_vm_$num','$at_tvm_find_$num')");
 }
 insert_it("1");
 insert_it("2");
 insert_it("3");
 insert_it("4");
 insert_it("5");
}

----------------------------------------------------

require("../tpls/$tpl/header.php");

$num_datas = mysql_num_rows(mysql_query("select * from pk_at_data"));
$newest_data_a = mysql_query("select at_name from pk_at_data order by at_name desc limit 0,1");
$newest_data_b = mysql_query("select at_name from pk_at_data order by at_name desc limit 1,1");
$newest_data_c = mysql_query("select at_name from pk_at_data order by at_name desc limit 2,1");
$at_num_tms = mysql_num_rows(mysql_query("select * from pk_at_data where at_tm != '0'"));
$at_num_vms = mysql_num_rows(mysql_query("select * from pk_at_data where at_vm != '0'"));

echo("<tr>
  <td height="25" class="site_box_title" align="center">
  <b>Statistiken</b>
  </td>
 </tr>
 <tr>
  <td class="row1">
  <span class="site_box">
  Eingetragene Attacken:<br>
  <li>Gesamt: <b>$num_datas von 248</b><br>
  <li>Dv. TMs:<b>$at_num_tms von 50</b><br>
  <li>Dv. VMs: <b>$at_num_vms von 7</b><br><br>
  Die neuesten Einträge sind: ");
  while(list($at_name) = mysql_fetch_array($newest_data_a))
  {
    echo("<li><a href="at_show.php?at_name=$at_name">$at_name</a> ");
  }
  while(list($at_name) = mysql_fetch_array($newest_data_b))
  {
    echo("<li><a href="at_show.php?at_name=$at_name">$at_name</a> ");
  }
  while(list($at_name) = mysql_fetch_array($newest_data_c))
  {
    echo("<li><a href="at_show.php?at_name=$at_name">$at_name</a>");
  }

echo("</td>
 </tr>");

require("../tpls/$tpl/body.php");

function start_input($num)
{
 echo("<input type="text" class="main_input" name="at_name_$num" style="width: 500px" value="Attackenname"><br>
 <input type="text" class="main_input" name="at_wirkung_$num" style="width: 500px" value="Wirkung der Attacke"><br>
 <select name="at_wirk_typ_$num"  class="main_select" style="width: 500px">
 <option value="failed">Art der Wirkung selektieren.
  ");
 $result_at_types = mysql_query("select * from pk_at_types order by at_typ");
 while(list($id, $at_typ) = mysql_fetch_array($result_at_types))
 {
  echo("<option value="at_wirk_typ_$id">$at_typ");
 }
 echo("</select><br>
 <select name="at_typ_$num" class="main_select" style="width: 120px"><option value="failed">Attackentyp
  ");
 $result_at_types = mysql_query("select * from pk_types order by typ");
 while(list($id, $typ) = mysql_fetch_array($result_at_types))
 {
  echo("<option value="at_typ_$id">$typ");
 }
 echo("</select> <input type="text" class="main_input" name="at_sp_$num" style="width: 120px" value="SP"> <input type="text" class="main_input" name="at_ap_$num" style="width: 123px" value="AP"> <input type="text" class="main_input" name="at_genau_$num" style="width: 123px" value="Genauigkeit (%)"><br>
 <input type="text" class="main_input" name="at_tm_$num" style="width: 120px" value="TM Nummer"> <input type="text" class="main_input" name="at_vm_$num" style="width: 120px" value="VM Nummer"> <input type="text" class="main_input" name="at_tvm_find_$num" style="width: 250px" value="TVM Fundort"<br><br><br><br><br>
 ");

}

echo("<form method="post" action="at_in.php">");
start_input("1");
start_input("2");
start_input("3");
start_input("4");
start_input("5");
echo("<input type="submit" name="submit" class="main_input" value="Eintragen!">");

require("../tpls/$tpl/bottom.php");

?>

Es funktioniert alles so wie es sollte ... außer, dass mysql_query("Insert..."); nicht funktioniert. PHP gibt zwar keinen Fehler aus, jedoch wird in die Datenbank nichts eingetragen. (Die Datenbankverbindung ist richtig, die Variablen werden auch übergeben, und aufs submitfeld habe ich auch gedrückt, sprcih am nur Enter drücken liegt es auch nicht.

Danke im Voraus
Thomas