Autor Zpráva
mee
Profil *
Delam tridu na automaticke generovani a zapisovani tabulek do databaze ale nejde mi predavat hodnotu pole v objektu pise mi to
Warning: Invalid argument supplied for foreach() in C:\Program Files\EasyPHP 3.0\www\class\create.php on line 48

<?php
class my_create_table {

  function __construct() {
    $this->connect = @mysql_connect("localhost", "x", "");
    mysql_select_db("admin");
  }
  function count($number = 3) {
    $this->count = $number;
  }
  function generate() {
    $n = $this->count;
    $i = 0;
    print "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
    print "<table>";
    for( is_numeric($n) ; $i < $n ; $i++ ) {
      print "<tr>";
      print "<td>Prvek:</td>";
      print "<td>&nbsp;</td>";
      print "<td><input type=\"text\" name=\"thing$i\" /></td>";
      print "<td>Vlastnosti:</td>";
      print "<td>&nbsp;</td>";
      print "<td><input type=\"text\" name=\"properties$i\" /></td></tr>";
      $this->thing = array();
      $this->thing = "thing$i";
      $this->properties = array();
      $this->properties = "properties$i";
    }
    print "<tr>";
    print "<td></td>";
    print "<td>&nbsp;</td>";
    print "<td></td>";
    print "<td></td>";
    print "<td>&nbsp;</td>";
    print "<td><input type=\"submit\" value=\"Odeslat\" /></td></tr>";
    print "</table";
    print "</form>";
  }

  function create() {
  
  }
}

$a = new my_create_table();
$a->count();
$a->generate();
foreach($a->thing as $value) {
  echo $value;
}
?>
mee
Profil *
tak uz sem na to prisel


<?php
class my_create_table {

  function __construct() {
    $this->connect = @mysql_connect("localhost", "x", "");
    mysql_select_db("admin");
  }
  function count($number = 3) {
    $this->count = $number;
  }
  function generate() {
    $n = $this->count;
    $i = 0;
    $this->thing = array();
    $this->properties = array();
    print "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";
    print "<table>";
    for( is_numeric($n) ; $i < $n ; $i++ ) {
      print "<tr>";
      print "<td>Prvek:</td>";
      print "<td>&nbsp;</td>";
      print "<td><input type=\"text\" name=\"thing$i\" /></td>";
      print "<td>Vlastnosti:</td>";
      print "<td>&nbsp;</td>";
      print "<td><input type=\"text\" name=\"properties$i\" /></td></tr>";
      $this->thing[] = "thing$i";
      $this->properties[] = "properties$i";
    }
    print "<tr>";
    print "<td></td>";
    print "<td>&nbsp;</td>";
    print "<td></td>";
    print "<td></td>";
    print "<td>&nbsp;</td>";
    print "<td><input type=\"submit\" value=\"Odeslat\" /></td></tr>";
    print "</table";
    print "</form>";
  }

  function create() {
  
  }
}

$a = new my_create_table();
$a->count();
$a->generate();
foreach($a->thing as $value) {
  echo $value;
}
?>
Pinqui
Profil
Jsem trochu laik, ale kde jsi sebral $a->thing není to blbost??
Kcko
Profil
Sebral to v te tride, nedefinovane clenske pole.
Tohle ma sice obal "tridy", ale je to naprosto k nicemu.
fuckin
Profil
Tohle ma sice obal "tridy", ale je to naprosto k nicemu.
Pravda nestoji to za nic. To vytvoreni te tabulky je vrchol :D.

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: