数据库写不进,库里面有的记录读不出 你在filmsave.php 文件前加入echo $filmname,echo $filmtype,...看能不能显示想关内容? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 最近是不是PHP都有着毛病啊我也是~可以读取、修改就是不能写入 搞定了.1.index.php不需要修改,没有错误2.filmsave.php<html> <head> <title>显示列表</title> </head> <body> <a href="filmview.php">影片列表</a> <p> <?php $date=date("Y-m-d H:i:s"); //这里你原来错了,所以送不进数据库$link = mysql_pconnect("192.168.0.1","root","");mysql_select_db("vodsystem",$link); $str = "INSERT INTO filmlist (filmname,filmtype,filmpath,inputdate,comment) VALUES ('$filmname','$filmtype','$filmpath','$date','$comment')"; mysql_query ($str,$link); ?> </body> </html> 3.filmview.php<html> <head> <title>影片列表</title> </head> <table border="0" width="100%"> <tr> <td width="20%" align="center" bgcolor="#99ccff"> <font color="#ffffff">影片名称</font> </td> <td width="10%" align="center" bgcolor="#99ccff"> <font color="#ffffff">影片类型</font> </td> <td width="52%" align="center" bgcolor="#99ccff"> <font color="#ffffff">影片简介</font> </td> <td width="18%" align="center" bgcolor="#99ccff"> <font color="#ffffff">入库时间</font> </td> </tr> </table> <table border="0" width="100%"> <? $link = mysql_pconnect("192.168.0.1","root",""); mysql_select_db("vodsystem",$link); $str="Select filmname,filmpath,filmtype,inputdate,comment from filmlist";//以下是修改过的,你自己看看吧,估计应该看的懂$result = mysql_query ($str,$link); $numrows=mysql_num_rows($result);if($numrows==0){ echo "<tr><td colspan='4'>"; echo "<div align='center'>没有符合条件的信息!</div>"; echo "</td</tr>";}else{ while ($RS=mysql_fetch_array($result)){ ?> <tr> <td width="20%" align="center"><a href="<?echo $RS["filmpath"];?>"><?echo $RS["filmname"];?></a></td> <td width="10%" align="center"><?echo $RS["filmtype"];?></td> <td width="52%" align="center"><?echo $RS["comment"];?></td> <td width="18%" align="center"><?echo $RS["inputdate"];?></td> </tr> <? } }?> </table> </html> 测试完全通过了,另外我觉得有些东西你应该放到一个文件中,譬如连接数据库的那段代码,如果象你这么写,今后如果修改密码的话,你要一个文件一个文件的改,嘻嘻,给分~_~ thinkphp不能在空间运行 大家請進!! 请问使用DISCUZ!的论坛,如果租虚拟主机,需要额外租MYSQL数据库吗? 时间去掉年 才转PHP 为了建立一个个人代码库 100分求程序代码 smarty,phplib,adodb我該用哪個好? 我的mysql怎么启动不了? 如何從以下變為, php的一帮人太差劲了,我决定退出这个分论坛。 vici(liuyuande):好事做到底!再帮我一把! 一个变量传递的问题(好建议保证给高分) 文件的问题
1.index.php不需要修改,没有错误2.filmsave.php
<html> <head>
<title>显示列表</title>
</head>
<body>
<a href="filmview.php">影片列表</a>
<p>
<?php
$date=date("Y-m-d H:i:s"); //这里你原来错了,所以送不进数据库
$link = mysql_pconnect("192.168.0.1","root","");
mysql_select_db("vodsystem",$link);
$str = "INSERT INTO filmlist (filmname,filmtype,filmpath,inputdate,comment) VALUES ('$filmname','$filmtype','$filmpath','$date','$comment')";
mysql_query ($str,$link);
?>
</body>
</html> 3.filmview.php
<html> <head>
<title>影片列表</title>
</head>
<table border="0" width="100%">
<tr>
<td width="20%" align="center" bgcolor="#99ccff">
<font color="#ffffff">影片名称</font>
</td>
<td width="10%" align="center" bgcolor="#99ccff">
<font color="#ffffff">影片类型</font>
</td>
<td width="52%" align="center" bgcolor="#99ccff">
<font color="#ffffff">影片简介</font>
</td>
<td width="18%" align="center" bgcolor="#99ccff">
<font color="#ffffff">入库时间</font>
</td>
</tr>
</table>
<table border="0" width="100%">
<?
$link = mysql_pconnect("192.168.0.1","root","");
mysql_select_db("vodsystem",$link);
$str="Select filmname,filmpath,filmtype,inputdate,comment from filmlist";
//以下是修改过的,你自己看看吧,估计应该看的懂
$result = mysql_query ($str,$link);
$numrows=mysql_num_rows($result);
if($numrows==0){
echo "<tr><td colspan='4'>";
echo "<div align='center'>没有符合条件的信息!</div>";
echo "</td</tr>";
}else{
while ($RS=mysql_fetch_array($result))
{
?>
<tr>
<td width="20%" align="center"><a href="<?echo $RS["filmpath"];?>"><?echo $RS["filmname"];?></a></td>
<td width="10%" align="center"><?echo $RS["filmtype"];?></td>
<td width="52%" align="center"><?echo $RS["comment"];?></td>
<td width="18%" align="center"><?echo $RS["inputdate"];?></td>
</tr>
<?
} }
?>
</table>
</html>
测试完全通过了,另外我觉得有些东西你应该放到一个文件中,譬如连接数据库的那段代码,如果象你这么写,今后如果修改密码的话,你要一个文件一个文件的改,嘻嘻,给分~_~