Geachte PHP'ers
Ik heb een fout in mijn script.
Maar ik weet maar niet wat ik fout doe!! :S
De foutmelding is die ik krijg:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\wamp\www\paginas\forum\handlers\handle_selecttopic.php on line 39
Kan iemand mij de uitleg geven wat ik fout doe ?
<?php
session_start();
?>
<link href="/paginas/css/lettertypen.css" rel="stylesheet" type="text/css" />
<?php
if ($_SESSION['user_ID'] == "")
{
print("<div align=\"center\"><span class=\"xbig\">Je bent niet ingelogd!</span><br /> <br /><span class=\"style4\"><a href=\"/paginas/login.php\">Hier</a> kun je je inloggen</span></div>");
exit;
}
//Informatie uit GET halen.
$topic_name = $_GET['topic'];
$topic_id = $_GET['id'];
$parent1 = $_GET['parent1'];
//verbinding maken met da database!
$dbc = mysql_connect('localhost', '****', '******);
mysql_select_db('knorfski', $dbc);
//Query's aanmaken
$query2 = "select * from forum_inhoud WHERE parent2='$topic_name' order by id DESC";
//Query's uitvoeren
$result2 = mysql_query($query2, $dbc);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Topic</title>
</head>
<body>
<div align="center">
<table width="500" height="103" border="1">
<?php while($row = mysql_fetch_array($result2)) {?>
<tr>
<td height="53"><div align="center" class="style4">
<p><strong><?php echo $row['maker']; ?> schreef:</strong></p>
<p align="center"><strong><br />
</strong><?php echo $row['inhoud']; ?></p>
</div></td>
</tr>
<tr>
<td>
<div align="center">Gepost op: <?php echo $row['datum']; ?> </div>
</td>
</tr>
<br />
<?php } ?>
</table>
<br />
<br />
<table width="500" border="1">
<tr>
<td height="318"><form id="form1" name="form1" method="post" action="/paginas/forum/handlers/handle_postreply.php?topic=<?php print("$topic_name"); ?>&parent1=<?php print($parent1); ?>"><textarea name="reply" rows="15" cols="100"></textarea>
</label>
<p align="center">
<label>
<input type="submit" name="Submit" value="Post reply!" />
</label>
</p>
</form>
</td>
</tr>
</table>
<br />
<br />
</div>
</body>
</html>
<?php
mysql_close()
?>
</div>
1.258 views