if(isset($id))
{
$query = "SELECT * FROM members WHERE id='$id'";
$result = mysql_query($query) or die(mysql_error());
while($obj = mysql_fetch_object($result))
{
$num = $obj->viewed;
$num1 = $num +1;
$query1 = "UPDATE members SET viewed='$num1' WHERE id='$obj->id'";
$result = mysql_query($query1) or die(mysql_error());
if(isset($_GET['id'])) {
$id = (int) $_GET['id']; // de (int) zorgt ervoor dat alleen getallen doorkomen
$query = "SELECT * FROM members WHERE id='".$id."'";
$result = mysql_query($query) or die(mysql_error());
while($obj = mysql_fetch_object($result))
{
$num = $obj->viewed;
$num1 = $num +1;
$query1 = "UPDATE members SET viewed='$num1' WHERE id='$obj->id'";
$result = mysql_query($query1) or die(mysql_error());