-6
$uid = $_GET['id'];
echo $sql = "select * from notice where id=$uid";
echo $result = mysql_query($sql);
$row = mysql_fetch_array($result);
    echo $row['headline'];
    echo $row['description'];
    echo $row['image'];

Is producing

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\willammary\staff-admin\edit_notice.php on line 5
Augusto
  • 761
  • 5
  • 18

1 Answers1

0

Try this,

$uid = $_GET['id'];
echo $sql = "select * from notice where id=".$uid;
echo $result = mysql_query($sql);
if($result === FALSE) {
    die(mysql_error()); // error handling
}
$row = mysql_fetch_array($result);
echo $row['headline'];
echo $row['description'];
echo $row['image'];

Alternatively,

$uid = $_GET['id'];
echo $sql = "select * from notice where id=$uid";
echo $result = mysql_query($sql);
if($result) {
   $row = mysql_fetch_array($result);
   echo $row['headline'];
   echo $row['description'];
   echo $row['image'];
}

Or

$uid = $_GET['id'];
echo $sql = "select * from notice where id=$uid";
echo $result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
echo $row['headline'];
echo $row['description'];
echo $row['image'];

Also mysql extension is deprecated as of PHP 5.5.0 Read http://www.php.net/manual/en/intro.mysql.php

Rohan Kumar
  • 39,838
  • 11
  • 73
  • 103