Ovo radi:
Code:
<?php
$result=mysql_query("select * from guestbook") or die(mysql_error());
while ($row=mysql_fetch_array($result))
{
echo "<b>Name:</b>";
echo $row[0];
echo "<b>Location:</b>";
echo $row[1];
echo "<b>Email:</b>";
echo $row[2];
echo "<b>URL:</b>";
echo $row[3];
echo "<b>Comments:</b>";
echo $row[4];
echo"<br>\n";
}
mysql_free_result($result);
?>
<?php
$result=mysql_query("select * from guestbook") or die(mysql_error());
while ($row=mysql_fetch_array($result))
{
echo "<b>Name:</b>";
echo $row[0];
echo "<b>Location:</b>";
echo $row[1];
echo "<b>Email:</b>";
echo $row[2];
echo "<b>URL:</b>";
echo $row[3];
echo "<b>Comments:</b>";
echo $row[4];
echo"<br>\n";
}
mysql_free_result($result);
?>
Ovo ne radi:
Code:
<?php
$result=mysql_query("select * from guestbook") or die(mysql_error());
while ($row=mysql_fetch_array($result))
{
$num_fields=mysql_num_fields($result);
echo "<table border = 1>";
echo "<tr>";
for($i=0; $i<$num_fields; $i++)
{
echo "<td valign = top>";
echo $row[i];
echo "<td>";
}
echo "</tr>";
echo "</table>";
}
mysql_free_result($result);
?>
<?php
$result=mysql_query("select * from guestbook") or die(mysql_error());
while ($row=mysql_fetch_array($result))
{
$num_fields=mysql_num_fields($result);
echo "<table border = 1>";
echo "<tr>";
for($i=0; $i<$num_fields; $i++)
{
echo "<td valign = top>";
echo $row[i];
echo "<td>";
}
echo "</tr>";
echo "</table>";
}
mysql_free_result($result);
?>
Zasto?
Mislim, šta reći !