Re: inserting data into columns and rows in php.
| From: | Ed Vul | Date: | Tue, 25 Jul 2000 17:59:52 +0000 |
| Subject: | Re: inserting data into columns and rows in php. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8108@lists.php.net to get a copy of this message | ||
Now this comes with a disclaimer: I am new too, and this may have a bug or
two and it may not be the most efficient way to do it, but the idea is there
:p
(the reason i have if statements in there is that you may run out of data,
but you still have to finish the table row...)
hope this helps
<?
$db = mysql_connect("localhost", "xxx","yyy");
mysql_select_db("links",$db);
$result = mysql_query("SELECT * FROM links where location='USA' ,$db");
while($myrow = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td class=txtleft><a href=".$myrow["link"].">
".$myrow["link"]."
</td>\n";
echo "<td class=txtleft>";
if($myrow = mysql_fetch_array($result))
{
echo "<a href=".$myrow["link"].">
".$myrow["link"]." </a>";
}
echo "</td>\n";
echo "<td class=txtleft>";
if($myrow = mysql_fetch_array($result))
{
echo "<a href=".$myrow["link"].">
".$myrow["link"]." </a>";
}
echo "</td>\n";
echo "</tr>";
}
?>