What I have written works fine, only when I want to update several links to online, then he picks up only the last link from the database. Where do I error?
<?php
require "../config.php";
mysql_connect("$database_host", "$database_user", "$database_password") or die(mysql_error());
mysql_select_db("$database_name") or die(mysql_error());
if($_POST['online'] == '1')
{
mysql_query ("UPDATE links SET approved = 1 WHERE link_id = '{$_POST['link_id']}'");
}
$linken_offline = mysql_query("SELECT * FROM links WHERE approved = 0")
or die(mysql_error());
print "<h2>Links die offline staan</h2>
<form name=\"update\" action=\"index.php?page=linkoverview\" method=\"post\">
<table width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr style=\"font-weight:bold;\">
<td>Link ID</td>
<td>Linknaam</td>
<td>URL</td>
<td>Contactpersoon</td>
<td>Email</td>
<td>Referrer URL</td>
<td>Categorie</td>
<td>Link online</td>
</tr>";
while($links = mysql_fetch_array( $linken_offline )){
include "replace_numbers.php";
print "
<tr>
<td>" . $links['link_id'] . "</td>
<td>" . $links['linknaam'] . "</td>
<td><a href=\"" . $links['url'] . "\">" . $links['url'] . "</a></td>
<td>" . $links['contactpersoon'] . "</td>
<td>" . $links['email'] . "</td>
<td><a href=\"" . $links['referrer'] . "\">" . $links['referrer'] . "</a></td>
<td>" . $links['cat_id'] . "</td>
<td><input type=\"hidden\" name=\"link_id\" value=\"" . $links['link_id'] . "\">
<input type=\"checkbox\" name=\"online\" value=\"1\"></td>
</tr>
";
}
print "</table>
<input type=\"submit\" value=\"submit\" id=\"button\"/>
</form>
";
?>