简单跳转问题 如何把这里<li><a href="only.php">第<?=$row['0'];?>个帖子</a><li>输出的记录在only页面得到 如何把这里<li><a href="only.php">第<?=$row['0'];?>个帖子</a><li>输出的记录在only页面得到 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如何把这里<li><a href="only.php">第<?=$row['0'];?>个帖子</a><li>输出的记录在only.php这个程序文件里面得到,对吗?还是不明白你是啥意思啊~~~ <li><a href="only.php?id=<?=$row['0'];?>">第<?=$row['0'];?>个帖子</a><li> 不好意思 我是说如何把第一个页面里的<li><a href="only.php">第<?=$row['0'];?>个帖子</a><li>$row['0'],给它送到第二个页面去only.php, 你看看二楼的,常用的方法通过url传参数数据接收通过$_GET['id'];即可 代码如下 可是传不过去<!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=gb2312" /><title>查看所有帖子页面</title></head><body><? $mysql_server_name = "localhost"; $mysql_username = "lipichang"; $mysql_password = "123456"; $mysql_database = "lyb"; //建立连线————透过(服务器地址,使用名称,密码) $conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password); $sql = "SELECT * FROM `newinsert`"; mysql_select_db($mysql_database,$conn); mysql_query("SET NAMES 'gbk'"); $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $id=$row[0];?> <li><a href="only.php">第<?=$row['in_id'];?>个帖子</a><li> 发表人:<?=$row['1']."先生(小姐)";?> <li><a href="only.php">标题:<?=$row['2'];?></a></li> <li>发表时间:<?=$row['4'];?></a></li> <? echo "<P>-------------------------------------------------------<P>";?><? } mysql_free_result($result);?></body></html> only.php<!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=gb2312" /><title>查看帖子单独页面</title></head><body><? $in_id = $_REQUEST['in_id']; $mysql_server_name = "localhost"; $mysql_username = "lipichang"; $mysql_password = "123456"; $mysql_database = "lyb"; echo $in_id; //建立连线————透过(服务器地址,使用名称,密码) $conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password); $sql = "SELECT * FROM `newinsert` where in_id = ".$in_id; echo $sql; mysql_select_db($mysql_database,$conn); mysql_query("SET NAMES 'gbk'"); $result = mysql_query($sql); while($row = mysql_fetch_row($result)) { print_r($result); }?></body></html> <li><a href="only.php">第<?=$row['in_id'];?>个帖子</a><li>改成<li><a href="only.php?in_id=<?php echo $row['in_id'];?>">第<?=$row['in_id'];?>个帖子</a><li> 报错如下 SELECT * FROM `newinsert` where in_id = Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in F:\AppServ\www\only.php on line 31 列表页程序文件里面“ <li><a href="only.php">第<?=$row['in_id'];?>个帖子</a><li>”应该改为: <li><a href="only.php?id=<?=$row['in_id']?>">第<?=$row['in_id'];?>个帖子</a><li>------------------------详细页 only.php 里面代码如下:<!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=gb2312" /><title>查看帖子单独页面</title></head><body><? //$in_id = $_REQUEST['in_id']; $in_id = intval($_GET['in_id']); if($in_id <= 0) exit('BAD_REQUEST'); $mysql_server_name = "localhost"; $mysql_username = "lipichang"; $mysql_password = "123456"; $mysql_database = "lyb"; echo $in_id; //建立连线————透过(服务器地址,使用名称,密码) $conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password); mysql_select_db($mysql_database,$conn); mysql_query("SET NAMES 'gbk'"); $sql = "SELECT * FROM `newinsert` where in_id = ".$in_id; echo $sql; $result = mysql_query($sql); while($row = mysql_fetch_row($result)) { //print_r($result); print_r($row); }?></body></html> 哦,写错了,是参数是 in_id= 而不是 id= <li><a href="only.php?in_id=<?php echo $row['in_id'];?>">第<?=$row['in_id'];?>个帖子</a><li>only.php<? $in_id = $_REQUEST['in_id']; //获取第几个帖子传过来的参数in_id$sql = "SELECT * FROM `newinsert` where in_id = ".$in_id; echo $sql;//$sql 输出是什么。。 OAuth2.0接口认证机制开发 php上传字段保存到mysql 这个php代码如何打开,望高手指点 wordpress中文章页面中执行PHP连接MYSQL数据库出错 php里面的if添加php调用能执行吗? 创新,创业,创富(北京海淀) 求一段php+mssql的分页显示的代码. 请高手指点 能否想办法让A服务器的程序调用B服务器的数据库? 谁知道这个错误是怎么造成的!!谢谢了!! (菜鸟飞飞)比如一个数值为3.33446666666.我怎么截取小数点后前2位 ===简单的正则问题===
还是不明白你是啥意思啊~~~
$row['0'],给它送到第二个页面去only.php,
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查看所有帖子页面</title>
</head><body>
<?
$mysql_server_name = "localhost";
$mysql_username = "lipichang";
$mysql_password = "123456";
$mysql_database = "lyb";
//建立连线————透过(服务器地址,使用名称,密码)
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
$sql = "SELECT * FROM `newinsert`";
mysql_select_db($mysql_database,$conn);
mysql_query("SET NAMES 'gbk'");
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
$id=$row[0];
?>
<li><a href="only.php">第<?=$row['in_id'];?>个帖子</a><li>
发表人:<?=$row['1']."先生(小姐)";?>
<li><a href="only.php">标题:<?=$row['2'];?></a></li>
<li>发表时间:<?=$row['4'];?></a></li>
<? echo "<P>-------------------------------------------------------<P>";?>
<?
}
mysql_free_result($result);
?>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查看帖子单独页面</title>
</head><body>
<?
$in_id = $_REQUEST['in_id'];
$mysql_server_name = "localhost";
$mysql_username = "lipichang";
$mysql_password = "123456";
$mysql_database = "lyb";
echo $in_id;
//建立连线————透过(服务器地址,使用名称,密码)
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
$sql = "SELECT * FROM `newinsert` where in_id = ".$in_id;
echo $sql;
mysql_select_db($mysql_database,$conn);
mysql_query("SET NAMES 'gbk'");
$result = mysql_query($sql);
while($row = mysql_fetch_row($result))
{
print_r($result);
}?></body>
</html>
改成
<li><a href="only.php?in_id=<?php echo $row['in_id'];?>">第<?=$row['in_id'];?>个帖子</a><li>
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in F:\AppServ\www\only.php on line 31
列表页程序文件里面
“ <li><a href="only.php">第<?=$row['in_id'];?>个帖子</a><li>”应该改为:
<li><a href="only.php?id=<?=$row['in_id']?>">第<?=$row['in_id'];?>个帖子</a><li>
------------------------
详细页 only.php 里面代码如下:<!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=gb2312" />
<title>查看帖子单独页面</title>
</head><body>
<?
//$in_id = $_REQUEST['in_id'];
$in_id = intval($_GET['in_id']);
if($in_id <= 0) exit('BAD_REQUEST'); $mysql_server_name = "localhost";
$mysql_username = "lipichang";
$mysql_password = "123456";
$mysql_database = "lyb";
echo $in_id; //建立连线————透过(服务器地址,使用名称,密码)
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password); mysql_select_db($mysql_database,$conn); mysql_query("SET NAMES 'gbk'"); $sql = "SELECT * FROM `newinsert` where in_id = ".$in_id; echo $sql; $result = mysql_query($sql);
while($row = mysql_fetch_row($result))
{
//print_r($result);
print_r($row); }?></body>
</html>
哦,写错了,是参数是 in_id= 而不是 id=
only.php
<?
$in_id = $_REQUEST['in_id']; //获取第几个帖子传过来的参数in_id$sql = "SELECT * FROM `newinsert` where in_id = ".$in_id;
echo $sql;//$sql 输出是什么。。