为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我这里显示 Query was empty

<?php

require_once('../connect.php');

$query=mysql_query("select * from article where id=1");

$data=mysql_fetch_assoc($query);

echo mysql_error();

?>

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>修改界面</title>

<style type="text/css">

body{margin: 0;padding: 0;}

html,body{width: 100%;height: 100%;}

.nav{background: yellow;border-bottom: 1px solid #000000;width: 100%;height: 10%;}

.left_nav{background: yellow;border-right: 1px solid #000000;text-align: center;font-size: 24px;padding-top: 1px;width: 10%;height: 90%;float: left;}

.left_nav div{margin-top: 80px;}

.show{float: left;width: 80%;}

.show_c{margin-left: 40px;font-size: 18px;}

.title,.author,.description,.content{clear: both;margin-bottom: 40px;}

.title,.author{height: 20px;}

.description{height: 200px;}

.content{height: 280px;}

.show_title{text-align: center;font-size:36px;padding: 40px;}

.show_left{float: left;margin-right: 100px;}

.show_right{float: left;}

.text{width: 200px;height: 20px;}

.textarea1{width: 880px;height: 200px;}

.textarea2{width: 880px;height: 280px;}

.button{margin: 0 auto;width: 200px;}

</style>

</head>

<body>

<div class="nav"></div>

<div class="left_nav">

<a href="#"><div>文章发布</div></a>

<a href="#"><div>文章管理</div></a>

</div>

<div class="show">

<div class="show_title">修改文章</div>

<form id="form1" name="form1" method="post" action="article.modify.handle.php" class="show_c">

<input type="hidden" name="id" value="<?php echo $data['id'] ?>" />

<div class="title">

<div class="show_left">标题</div>

<input type="text" name="title" id="title" value="<?php echo $data['title']?>" class="show_right text">

</div>

<div class="author">

<div class="show_left">作者</div>

<input type="text" name="author" id="author" value="<?php echo $data['author']?>" class="show_right text">

</div>

<div class="description">

<div class="show_left">简介</div>

<textarea name="description" id="description" class="show_right textarea1"><?php echo $data['description']?></textarea>

</div>

<div class="content">

<div class="show_left">内容</div>

<textarea name="content" id="content" class="show_right textarea2"><?php echo $data['content']?></textarea>

</div>

<div class="button">

<input type="submit" name="button" id="button" value="提交">

</div>

</form>

</div>

</body>

</html>


正在回答

2 回答

这个错误表示   无效的 SQL 语句,SQL 语句为空

0 回复 有任何疑惑可以回复我~
#1

长梦3468490 提问者

找到原因了,SQL错了 谢谢
2016-08-25 回复 有任何疑惑可以回复我~

<?php

require_once('../connect.php');

$query=mysql_query("select * from article where id=1");

$data=mysql_fetch_assoc($query);

echo mysql_error();

?>

检查下代码是否保存成功  是否有article这个数据库 是否有id=1的数据

0 回复 有任何疑惑可以回复我~
#1

长梦3468490 提问者

数据库和id是没问题的
2016-08-25 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
PHP与MySQL关系大揭秘
  • 参与学习       72509    人
  • 解答问题       978    个

让我们一起走上探秘之旅,找寻php和mysql恋爱的真谛

进入课程

为什么我这里显示 Query was empty

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号