really weird html - was "extract() help"
| From: | Jaxon | Date: | Sun, 25 Feb 2001 07:38:01 +0000 |
| Subject: | really weird html - was "extract() help" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41554@lists.php.net to get a copy of this message | ||
I replaced extract() with $row[] - much better.
Now I have the strangest thing happening - the <td align="right"> html
formatting only applies to the first iteration in the loop, even though it
shows up in the html source!!
regard,
jaxon
html generation:
----------------
for ($i = 1; $i <= 5; $i++)
{
$sql="select stuff from table";
$result = mysql_query($sql, $link_id);
$row = mysql_fetch_row($result);
echo "
<tr><td><h3>$row[2]</h3></td></tr>
<tr><td><h4>$row[3]</h4></td></tr>
<tr><td
align=\"right\"><h6>$row[1]</h6></td></tr>
<tr><td>$row[4]</td></tr>
<tr><td align=\"right\"><a
href=\"news.php?#$row[0]\"><h5>...more</h5></a></td></tr>
<hr />
";
echo "</table>";
}
resultant source:
-----------------
<table border="0" cellpadding="1" cellspacing="0">
<tr><td><h3>First Headline</h3></td></tr>
<tr><td><h4>first subtitle</h4></td></tr>
<tr><td
align="right"><h6>2001-02-24</h6></td></tr>
<tr><td>get it right here now... this is the place to be, I tell
you</td></tr>
<tr><td align="right"><a
href="news.php?#1"><h5>...more</h5></a></td></tr>
<tr><td><hr /></tr></td>
</table>
<tr><td><h3>SECOND HEADLINE!</h3></td></tr>
<tr><td><h4>second subtitle</h4></td></tr>
<tr><td
align="right"><h6>0000-00-00</h6></td></tr>
<tr><td>even more good stuff coming out of our second news
item!!!</td></tr>
<tr><td align="right"><a
href="news.php?#2"><h5>...more</h5></a></td></tr>
<tr><td><hr /></tr></td>
</table>
<tr><td><h3>HEADLINE 3!!!</h3></td></tr>
<tr><td><h4>subtitle 3</h4></td></tr>
<tr><td
align="right"><h6>2001-02-26</h6></td></tr>
<tr><td>getcha third item here!!</td></tr>
<tr><td align="right"><a
href="news.php?#3"><h5>...more</h5></a></td></tr>
<tr><td><hr /></tr></td>
</table>