Code:
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db", $con);
$result = mysql_query("SELECT * FROM tabela");
echo "<table border='1'>
<tr>
<th>Ime</th>
<th>Prezime</th>
<th>Fajl</th>
<th>ima nema fajla</th>
</tr>";
$imanemafajla = mysql_fetch_array($result);
if (empty($imanemafajla['fajl'])) {
$imanema = 'nema';
}else
{
$imanema = 'ima';
}
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ime'] . "</td>";
echo "<td>" . $row['prezime'] . "</td>";
echo "<td><a href=upload/".$row['fajl'] ."> fajl</a></td>" ;
echo "<td>" . $imanema ."</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db", $con);
$result = mysql_query("SELECT * FROM tabela");
echo "<table border='1'>
<tr>
<th>Ime</th>
<th>Prezime</th>
<th>Fajl</th>
<th>ima nema fajla</th>
</tr>";
$imanemafajla = mysql_fetch_array($result);
if (empty($imanemafajla['fajl'])) {
$imanema = 'nema';
}else
{
$imanema = 'ima';
}
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ime'] . "</td>";
echo "<td>" . $row['prezime'] . "</td>";
echo "<td><a href=upload/".$row['fajl'] ."> fajl</a></td>" ;
echo "<td>" . $imanema ."</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>