tigomark Posted February 15, 2008 Share Posted February 15, 2008 I am having problems with my loop statement. Doing a var_dump shows that I am getting an integer of 1 and 2 (expected) for each row. But the variable is not holding it for some reason. for ($i = 1; $i <= $this->formhandler; $i++){ $reporthtml .= sprintf("<td>%s</td>", $entry->reported_value[$i]); var_dump($i); } Link to comment https://forums.phpfreaks.com/topic/91309-problems-with-a-loop/ Share on other sites More sharing options...
tigomark Posted February 15, 2008 Author Share Posted February 15, 2008 I got it for ($i = 1; $i <= $this->formhandler; $i++){ $v = "reported_value".$i; $reporthtml .= sprintf("<td>%s</td>", $entry->$v); //var_dump($entry->reported_value[$i]); } However I now have another problem to get this to work and that is to create a header that limits itself by the same array if (is_array($this->dataTypes->data)) { reset($this->dataTypes->data); while (list($key, $val) = each ($this->dataTypes->data)) { if (($val->type != "N/A") && ($key <= $this->formhandler)) { $reporthtml .= sprintf("<td align=\"center\" nowrap=\"nowrap\">%s</td>", $val->name); } // $reporthtml .= sprintf("<td align=\"center\" nowrap=\"nowrap\">%s</td>", $val->name); } } Link to comment https://forums.phpfreaks.com/topic/91309-problems-with-a-loop/#findComment-467980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.