Bij het uitvoeren van onderstaande code krijg ik de foutmelding die hier ook onder staat. Het lijkt me dat het iets met de verbinding met database heeft te maken maar dat weet ik niet zeker. kan iemand me hierbij helpen?
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\gelinkte tabellen\test.php on line 39
<?php
//-------------------------------------------------
//Database openen en gegevens naar scherm schrijven
$host="localhost";
$username="root";
$dbnaam="test";
$fout= "FOUT: openen database mislukt";
$query = "SELECT t1.id, t1.naam, t1.adres, t1.woonplaats, t2.functie, t3.land FROM ";
$query .= "tbl_persoon AS t1, tbl_functie AS t2, tbl_land AS t3";
$query .= "WHERE t2.functie_id = t1.functie_id AND t3.land_id = t1.land_id";
//--- einde initalisatie
$db=mysql_connect($host, $username) or die($fout);
mysql_select_db($dbnaam, $db) or die($fout);
$result = mysql_query($query);
?>
<html>
<head>
<title>overzicht</title>
</head>
<body>
<h2 align="center">Overzicht<br>
</h2>
<p align="center"> </p>
<table width="50%" border="1" bordercolor="#000000" align="center">
<tr>
<th><div align="center"><strong>Naam</strong></div></th>
<th><div align="center"><strong>Adres</strong></div></th>
<th><div align="center"><strong>Woonplaats</strong></div></th>
<th><div align="center"><strong>Functie</strong></div></th>
<th><div align="center"><strong>Land</strong></div></th>
</tr>
<?php
while (list($id, $naam, $adres, $woonplaats, $functie, $land) = mysql_fetch_row($result)){
echo("<tr><td>$tnaam</td>
<td>$adres</td>
<td>$twoonplaats</td>
<td>$functie</td>
<td>$land</td>
</tr>\n");
}
?>
</body>
</html>
1.056 views