I've created a table with movies and a webpage where you can add more and view all of them. Now I'm trying to add if statements for if the edit or delete link has been clicked. Here is the code so far:
PHP Code:
<?php // movielibrary.php
require_once 'login.php';
$query = "SELECT * FROM library";
$result = mysql_query($query);
if (!$result) die ("Database access failed: " . mysql_error());
$rows = mysql_num_rows($result);
echo "<table border='1'><tr> <th>Title</th>
<th>Director</th>
<th>Year</th><th>Category</th>
<th>Update</th><th>Delete</th></tr>";
for ($j = 0 ; $j < $rows ; ++$j)
{
$row = mysql_fetch_row($result);
echo "<tr><td>$row[1]</td><td>$row[2]</td>
<td>$row[3]</td><td>$row[4]</td>
<td><a href='movielibrary.php?edit=$row[0]'>Edit</a</td>
<td><a href='movielibrary.php?delete=$row[0]'>Delete</a></td></tr>";
}
echo "</table>";
mysql_close($db_server);
?>
So my question is: how could I test the condition of if one of the links has been clicked? Thanks beforehand!