Autor | Zpráva | ||
---|---|---|---|
mee Profil * |
#1 · Zasláno: 8. 7. 2009, 20:09:38
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> </td>"; print "<td><input type=\"text\" name=\"thing$i\" /></td>"; print "<td>Vlastnosti:</td>"; print "<td> </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> </td>"; print "<td></td>"; print "<td></td>"; print "<td> </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 * |
#2 · Zasláno: 8. 7. 2009, 20:56:32
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> </td>"; print "<td><input type=\"text\" name=\"thing$i\" /></td>"; print "<td>Vlastnosti:</td>"; print "<td> </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> </td>"; print "<td></td>"; print "<td></td>"; print "<td> </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 |
#3 · Zasláno: 8. 7. 2009, 20:59:27
Jsem trochu laik, ale kde jsi sebral $a->thing není to blbost??
|
||
Kcko Profil |
#4 · Zasláno: 8. 7. 2009, 21:19:33
Sebral to v te tride, nedefinovane clenske pole.
Tohle ma sice obal "tridy", ale je to naprosto k nicemu. |
||
fuckin Profil |
#5 · Zasláno: 8. 7. 2009, 22:02:07
Tohle ma sice obal "tridy", ale je to naprosto k nicemu.
Pravda nestoji to za nic. To vytvoreni te tabulky je vrchol :D. |
||
Časová prodleva: 15 let
|
0