-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'];

生産しています

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
4

1 に答える 1

0

これを試して、

$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'];

あるいは、

$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'];
}

または

$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'];

また、 mysql 拡張PHP 5.5.0deprecatedの時点のものですhttp://www.php.net/manual/en/intro.mysql.phpを読む

于 2013-08-22T11:02:34.127 に答える