$msg = "";
$sql = "SELECT slika, naziv_filma, godina, trajanje FROM filmovi";
$myData = mysql_query($sql);
echo "<table border = '1'>
<tr>
<th>Slika</th><th>Naziv filma</th><th>Godina</th><th>Trajanje</th><th>Akcija</th></tr>";
while($record = mysql_fetch_array($myData))
{
echo "<form action = 'unos.php' method = 'post' enctype='multipart/form-data'>";
echo "<tr>";
echo "<td>" . $msg.= '<img src="data:image/jpeg;base64,'.base64_encode($record['slika']) .'"/>' . "</td>";
echo "<td>" . $record['naziv_filma'] . "</td>";
echo "<td>" . $record['godina'] . "</td>";
echo "<td>" . $record['trajanje'] . "</td>";
echo '<td><a href="unos.php?id='.$record['id'].'">Obriši</a></td>';
if(isset($_GET['delete']))
{
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$id = $_GET['id'];
$sql = "DELETE FROM filmovi WHERE id = '".$id."'" ;
mysql_select_db('kolekcija');
$retval = mysql_query( $sql, $conn );
header("Location: unos.php");
}
echo "<input type = 'hidden' name = 'id' value = 'id' />";
}
echo "</tr>";
echo "</form>";
echo "</table>";
I keep getting an error stating that the index id is not found.. I tried everything but it won't delete that specific row. I have a database with movies and the idea is that when the user clicks the "Obriši" button the selected movie gets deleted from the database "kolekcija". But it won't work? Can you please advise..?