Warning: count(): Parameter must be an array or an object that implements Countable in C:\wamp64\www\adresboek\view.php on line 8
Ik ben helaas nog niet zo gevorderd om nu te kunnen zien wat het probleem is. Hopelijk wil iemand mij een beetje op weg helpen hoe ik dit moet aanpakken. dit is mijn pagina.
<?php
include('server.php');
if (isset($_GET['edit'])) {
$id = $_GET['edit'];
$update = true;
$record = mysqli_query($db, "SELECT * FROM info WHERE id=$id");
if (count($record) == 1 ) {
$n = mysqli_fetch_array($record);
$id = $n['id'];
$name = $n['name'];
$address = $n['address'];
$town = $n['town'];
$country = $n['country'];
$email = $n['email'];
$phone = $n['phone'];
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP Adresboek [MySQL]</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
</head>
<header>
<div class="topnav">
<a href="index.php">Home</a>
<a href="add.php">Toevoegen</a>
<a class="active" href="lijst.php">Lijst</a>
<a href="contact.php">Contact</a>
</div>
</header>
<body>
<?php if (isset($_SESSION['message'])): ?>
<div class="msg">
<?php
echo $_SESSION['message'];
unset($_SESSION['message']);
?>
</div>
<?php endif ?>
<?php $results = mysqli_query($db, "SELECT * FROM info"); ?>
<form method="post" action="server.php" >
<input type="hidden" name="id" value="<?php echo $id; ?>">
<div class="input-group">
<label><b>Naam</b></label>
<p><?php echo $name; ?></p>
</div>
<div class="input-group">
<label><b>Straat</b></label>
<p><?php echo $address; ?></p>
</div>
<div class="input-group">
<label><b>Plaats</b></label>
<p><?php echo $town; ?></p>
</div>
<div class="input-group">
<label><b>Land</b></label>
<p><?php echo $country; ?></p>
</div>
<div class="input-group">
<label><b>E-Mail</b></label>
<p><?php echo $email; ?></p>
</div>
<div class="input-group">
<label><b>Telefoon</b></label>
<p><?php echo $phone; ?></p>
</div>
<hr>
<div class="input-group">
<a href="lijst.php" class="btn"><span class='glyphicon glyphicon-menu-left'></a>
<a href="update.php?edit=<?php echo $id; ?>"class="btn"><span class='glyphicon glyphicon-pencil'></span></a>
<a href="server.php?del=<?php echo $id; ?>" class="btn"><span class='glyphicon glyphicon-trash'></span></a>
</div>
</form>
</body>
</html>