求大神帮忙,php+MySQL问题,急!!!
各位看一下这里有没有语法错误,怎么显示不出数据来?<?include"conn.php";$query="Select*FROMreadwhereid=".$_GET['...
各位看一下这里有没有语法错误,怎么显示不出数据来?
<?
include "conn.php";
$query = "Select * FROM read where
id=".$_GET['id'];
$result = mysql_query($query);
$v_result =
@mysql_fetch_array($result);
?>
<table width="60%" border="0"
align="center" cellpadding="3" cellspacing="1" bgcolor="#0066FF">
<tr>
<td bgcolor="#FFFFFF">书名:</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><?php echo
$v_result['title'];?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">章节:</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><?php echo
$v_result['section'];?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">内容:</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><?php echo
$v_result['content'];?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><a
href="article_list.php">返回</a></td>
</tr>
</table> 展开
<?
include "conn.php";
$query = "Select * FROM read where
id=".$_GET['id'];
$result = mysql_query($query);
$v_result =
@mysql_fetch_array($result);
?>
<table width="60%" border="0"
align="center" cellpadding="3" cellspacing="1" bgcolor="#0066FF">
<tr>
<td bgcolor="#FFFFFF">书名:</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><?php echo
$v_result['title'];?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">章节:</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><?php echo
$v_result['section'];?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF">内容:</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><?php echo
$v_result['content'];?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><a
href="article_list.php">返回</a></td>
</tr>
</table> 展开
展开全部
<?php
require 'conn.php';
$sql = "SELECT * FROM `read` WHERE `id` = ".intval($_GET['id']);
$result = mysql_query($sql);
if($result && mysql_num_rows($result)){
$v_result = mysql_fetch_assoc($result);
//查询出数据
?>
<table>
</table>
<?php
}else{
exit('没有查询出数据');
}
?>
确保 conn.php 已经链接数据库 选择数据
望采纳 Thx
追问
原来把你的代码中require 'conn.php';换成include ("conn.php");就行了,大谢!复制去Google翻译翻译结果
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询