I'm trying to request all records with a specific value within the record
I have page where my custumers stands
behind that you get a link "overzicht installaties" this links to
That's where all information off that customer has to come but the request of all information with that specific customer isn't showing up what did i do wrong ?
----overzicht_klant.php----
<html>
<body>
<?php include('header.php'); ?>
<table width="auto" border="1">
<tbody>
<tr><td>Opdrachtgever</td><td>ID</td><td>Klant</td><td>Adres</td><td>Plaats</td><td>Telefoonnummer</td></tr>
<?php
require_once 'db_config.php';
$sql = "
SELECT
id,opdrachtgever,klant,adres,plaats,telefoonnr
FROM
klant
";
if(!$res = mysql_query($sql))
{
trigger_error(mysql_error().'<br />In query: '.$sql);
}
elseif(mysql_num_rows($res) == 0)
{
echo 'Geen resultaten gevonden';
}
else
{
while($row = mysql_fetch_assoc($res))
{
echo '<tr><td>'. $row['opdrachtgever'].'</td> ';
echo '<td>'. $row['id'].' </td> ';
echo '<td>'. $row['klant'].' </td> ';
echo '<td>'. $row['adres'].' </td> ';
echo '<td>'. $row['plaats'].' </td> ';
echo '<td>'. $row['telefoonnr'].'</td>';
echo '<td><a href=\klant.php?id=';
echo $row['klant'];
echo ">";
echo 'Overzicht Installaties</td></tr>';
}
} ?>
</tbody>
</table>
</body>
</html>
klant.php
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Klant Installaties</title>
</head>
<body>
<?php include('header.php')?>
<table border="1"><tr><td>Locatie</td><td>merk</td><td>model</td><td>type</td><td>serienummer</td><td>bouwjaar</td><td>afvoer</td><td>adres</td><td>poortnummer</td><td>filters</td></tr>
<?php
require_once 'db_config.php';
$id=mysql_real_escape_string($_GET['klant']);
$result = mysql_query("SELECT * FROM klant where klant=".$id.";");
if(!$res = mysql_query($result))
{
trigger_error(mysql_error().'<br />In query: '.$result);
}
elseif(mysql_num_rows($res) == 0)
{
echo '<tr><td>Geen resultaten gevonden</td></tr>';
}
else
{
while($row = mysql_fetch_assoc($res))
{
echo '<tr><td>'. $row['locatie'].'</td> ';
echo '<td>'. $row['merk'].' </td> ';
echo '<td>'. $row['model'].' </td> ';
echo '<td>'. $row['type'].' </td> ';
echo '<td>'. $row['serienr'].' </td> ';
echo '<td>'. $row['bouwjaar'].'</td>';
echo '<td>'. $row['afvoer'].'</td>';
echo '<td>'. $row['adres'].'</td>';
echo '<td>'. $row['poortnr'].'</td>';
echo '<td>'. $row['filter'].'</td></tr>';
}
} ?>
</tbody>
</table>
</body>
</html>