怎样把数据库的内容在html页面中显示 使用IFRAME内嵌PHP文件或有人发表留言后即时生成静态页面 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不想用iframe用javascript 怎么调用如在html页面中怎样显示计数器 在html中用js引入...<script src="leaveword.php?id=x"></script>leaveword.php 中<?php....echo "document.write('$content')";?>注意需要转换$content中的\n为\\n,'为\'如有\r则删去$content 里面可以是任意内容 我用你的方法不行啊我的文件如下ngq.php<?php $db = mysql_connect("localhost") or die("无法连接数据库!");mysql_select_db("ngq", $db) or die("无法选择数据库!");$result=mysql_query("select * from subject where id='$id'");$arr=mysql_fetch_array($result);$nums=$arr["nums"];echo"<script language='javascript'>";echo"document.write('$nums')";echo"</script>";mysql_close();?>我在index.html中调用不行啊<html><head><title>无标题文档</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF" text="#000000"><script src="http://localhost:1005/ngq/ngq.php?id=1"></script></body></html>请告诉我错在那里 //echo"<script language='javascript'>";echo"document.write('$nums')";//echo"</script>";<script src="http://localhost:1005/ngq/ngq.php?id=1"></script>将引入的内容做为脚本对待,等价于一个.js 文件。.js 文件中是不需要script标签的。 <?php $db = mysql_connect("localhost") or die("无法连接数据库!");mysql_select_db("ngq", $db) or die("无法选择数据库!");$result=mysql_query("select * from subject where id='$id'");$arr=mysql_fetch_array($result);$brr=mysql_num_rows($result);echo "<table border='1'> <td>"; echo "<tr> "; for($i=0;i<&brr;$i++){echo"<td align=center> i </td></tr>";}for($i=0;i<&brr;$i++){while ($r=mysql_fetch_array($result)) { $i=$r["i"];echo "<tr>"; echo "<td align='left'><font size='2'>$id</font></td>"; echo "</tr>"; } }echo "</table>"; mysql_close();?>紧供参考 php session_id 不停的变化 关于shell_exec的操作问题 散分了。 帮我解决一下这个是啥原因 【求助】 YII 框架跨应用模型间的调用 php中根据用户的操作显示相应图标的问题 iWPC2.3 内容管理系统发布 求助各位PHP中文本框问题。在线等待!~ 求一webmail程序 sql排序问题。请问有一个字段的值有5, 2,和0三种值。如何让2在最前面,然后在排序2数据的id倒叙 怎 样实现汉字的声母排序 请问PHP能直接处理存在变量中的XML吗?
如在html页面中怎样显示计数器
...
<script src="leaveword.php?id=x"></script>leaveword.php 中
<?php
....
echo "document.write('$content')";
?>注意需要转换$content中的\n为\\n,'为\'
如有\r则删去
$content 里面可以是任意内容
ngq.php<?php
$db = mysql_connect("localhost") or die("无法连接数据库!");
mysql_select_db("ngq", $db) or die("无法选择数据库!");
$result=mysql_query("select * from subject where id='$id'");
$arr=mysql_fetch_array($result);
$nums=$arr["nums"];
echo"<script language='javascript'>";
echo"document.write('$nums')";
echo"</script>";
mysql_close();
?>
我在index.html中调用不行啊
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000">
<script src="http://localhost:1005/ngq/ngq.php?id=1"></script>
</body>
</html>
请告诉我错在那里
echo"document.write('$nums')";
//echo"</script>";
<script src="http://localhost:1005/ngq/ngq.php?id=1"></script>
将引入的内容做为脚本对待,等价于一个.js 文件。
.js 文件中是不需要script标签的。
$db = mysql_connect("localhost") or die("无法连接数据库!");
mysql_select_db("ngq", $db) or die("无法选择数据库!");
$result=mysql_query("select * from subject where id='$id'");
$arr=mysql_fetch_array($result);
$brr=mysql_num_rows($result);
echo "<table border='1'>
<td>";
echo "<tr> ";
for($i=0;i<&brr;$i++)
{
echo"<td align=center> i </td></tr>";}
for($i=0;i<&brr;$i++)
{while ($r=mysql_fetch_array($result)) {
$i=$r["i"];
echo "<tr>";
echo "<td align='left'><font size='2'>$id</font></td>";
echo "</tr>";
}
}
echo "</table>";
mysql_close();
?>
紧供参考