Hi,
I have this bug:
mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/marlon/domains/webmasterplaats.nl/public_html/edit.php on line 36
This is the code:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$toegang[] = '86.91.195.26';
$toegang[] = '84.86.189.70';
$valid = true;
if(in_array($ip, $toegang) || isset($valid))
{
if(isset($_GET['id']))
{
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
mysql_query("UPDATE news SET titel='" . mysql_real_escape_string($_POST['titel']) . "', inhoud='" . mysql_real_escape_string($_POST['edit2']) . "' WHERE id='" . mysql_real_escape_string($_GET['id']) . "'");
echo 'Met success geupdate.' ;
}
$database = mysql_connect('localhost','marlonhe19','123456789asd');
mysql_select_db('wmp', $database);
$id = $_GET['id'];
$mysql = mysql_query("SELECT * FROM news WHERE id='$id' ;");
while($row = mysql_fetch_assoc($mysql)){
$id = $row['id'];
$titel = $row['titel'];
$inhoud = $row['inhoud'];
echo '
<form id="form1" name="form1" method="post" action="">
<input type="text" name="titel" value="$titel" /><br />
<textarea name="edit2">$inhoud</textarea> <br />
<input type="submit" name="Submit" value="Opslaan" />';
}
}
}
What's the problem?