| 请教一个问题[php] 
 根据地址$_GET['id']的值
 http://totoro123.com/video/?id=32502945
 显示相关留言内容怎样写>_<
 
 发表代码
 这是现在的显示ianime中的contents里面的数据的代码复制代码<?php
$conn=mysql_connect("localhost","root","123456");
//$conn=mysql_connect("localhost","asukatk_asuka","wsph123");
mysql_query("set names utf-8"); //解决中文乱码问题
mysql_select_db("ianime");//asukatk_anime
        if($_POST['post_contents']!=''){
$exec="insert into contents (name,email,pdate,content) values ('".$_POST['user_name']."','".strtolower($_POST['email'])."','".date('Y-m-d H:i:s')."','".$_POST['post_contents']."')";
$result=mysql_query($exec);
header('location:/video/?id=26534809');
}else{
header('Content-Type:text/html;charset=utf-8;');
echo '请输入留言内容<a href="javascript:history.back()">返回</a>';
};
?>
以上,先谢谢大家复制代码<?php
$conn=mysql_connect("localhost","root","123456");
//$conn=mysql_connect("localhost","asukatk_asuka","wsph123");
mysql_select_db("ianime"); //链接数据库
mysql_query("set names utf-8"); //解决中文乱码问题
$exec="select * from contents"; //sql语句
$result=mysql_query($exec); //执行sql语句,返回结果
while($rs=mysql_fetch_object($result)){
echo '<li><img src="http://www.gravatar.com/avatar/'.md5($rs->email).'?s=36"/><b>'.nl2br(htmlspecialchars($rs->name)).'</b><span>'.$rs->pdate.'</span>
<p>'.nl2br(htmlspecialchars($rs->content)).'</p></li>';
}?>
 [ 本帖最后由 卜卜口の 于 2010-5-5 18:36 编辑 ]
 |