Im having some problems with mysql_fetch_array. It says:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in /home/yeyddhiw/public_html/v.php on line 49
And i cant really see my problem.
My code is this:
<?php session_start(); ?>
<?php
if ($_SESSION['username'])
{
if($_SESSION['class'] == 'mod')
{
}
else
{
header("location:/");
exit();
}
}
else
{
header("location:/");
exit();
}
?>
<!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=utf-8" />
<title>Funnyshit</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body bgcolor="#171717">
<div id="head" align="center">
<?php include 'head.php';?>
</div>
<div id="content" align="center">
<?php
if ($_GET['id'])
{
include 'dbconnect_images.php';
$id = $_GET['id'];
$id = mysql_real_escape_string($id);
$sql = "SELECT * FROM images_notvalid WHERE id='$id')";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result))
{
echo $row['name'];
echo $row['path'];
echo $row['uploader'];
$sql2 = "INSERT INTO images (name, path, uploader) VALUES ('$name', '$path', '$uploader')";
$result2 = mysql_query($sql2);
$delete = "DELETE FROM images_notvalid WHERE name='$name' AND uploader='$uploader'";
$result3 = mysql_query($delete);
mysql_close($conn);
echo '<div class="error">Bildet er validert!</div>';
}
}
else
{
echo '<div class="error">Her mangler det data!</div>';
}
?>
</div>