php连接数据库 我做了一个简单的留言板,为什么添加到数据库中的中文字符不能正常显示都是“????”之类的,数字和英文是可以正常显示的! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在往数据库写如数据的时候先执行mysql_query('set names utf8');或者mysql_query('set names gb2312'); 刚才的问题解决了。可是又有了一个问题这是留言板的预览的PHP 文件,可为什么预览的不了啊!<?phpinclude("conn.php");?><table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef"><?$sql="select * from message order by id desc";$query=mysql_query($sql);while($row=mysql_fetch_array($query)){?> <tr bgcolor="#eff3ff"> <td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td> </tr> <tr bgColor="#ffffff"> <td>内容:<?=$row[content]?></td> </tr> <? } ?></table> $row['title']$row['user']$row['content'] 晕怎么又是你同样的错误犯第二次?太不应该了!http://topic.csdn.net/u/20110507/00/2585c9ab-983c-4fb6-a10f-ebdba0fe9078.html 不是这个原因啊!我找到了源码就是这样的$row[title]$row[user]$row[content] 至少是原因之一吧,把php代码块开始标签<?改为<?php.<?=$row[title]; ?>改为<?php echo $row['title']; ?><?这是短标签的写法,需要在php.ini中修改配置short_open_tag = On才行。 Notice: Undefined variable: row in D:\software\PHP\htdocs\list.php on line 12这个我已经改过了short_open_tag = On。 把你修改后的代码贴出来,这个提示的意思是$row变量未定义。 <?phpinclude("conn.php");?><table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef"><?$sql="select * from message order by id desc";$query=mysql_query($sql);while($row=mysql_fetch_array($query)){?> <tr bgcolor="#eff3ff"> <td>标题:<?php echo $row['title']; ?> 用户:<?php echo $row['user']; ?></td> </tr> <tr bgColor="#ffffff"> <td>内容:<?php echo $row['content']; ?></td> </tr> <? } ?></table> 看sql执行语句是否输出值,之后看循环是否有值,一步步的看看 <?phpinclude("conn.php");?><table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef"><?php$sql="select * from message order by id desc";$query=mysql_query($sql);while($row=mysql_fetch_array($query)){?> <tr bgcolor="#eff3ff"> <td>标题:<?php echo $row['title']; ?> 用户:<?php echo $row['user']; ?></td> </tr> <tr bgColor="#ffffff"> <td>内容:<?php echo $row['content']; ?></td> </tr> <?php } ?></table>世界上怕就怕认真二字 这段代码.能不能让他点击登陆按钮后.在另一个窗口中打开? 用php怎么进行这样的数组转换? 那位大师能讲讲 织梦标签替换原理? 请问www.xxx.con/index?type=music这样的url该怎样写重写URL正则 关于自助建站系统 正则表达式写法 打开网站时说调用数据库错误 在会话中,如何使用session_name(),它有什么作用?还有session_id()? 在Yii框架中通过ajax,怎么调取数据中的内容 多维数组如何按某个键进行排序? 关联数组键不可以是对象吗? PHP 日期转换怎么多了6个月代码如下
mysql_query('set names utf8');或者mysql_query('set names gb2312');
这是留言板的预览的PHP 文件,可为什么预览的不了啊!
<?php
include("conn.php");
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$sql="select * from message order by id desc";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
?>
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?> 用户:<?=$row[user]?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?=$row[content]?></td>
</tr>
<?
}
?>
</table>
$row['user']
$row['content']
http://topic.csdn.net/u/20110507/00/2585c9ab-983c-4fb6-a10f-ebdba0fe9078.html
我找到了源码就是这样的$row[title]
$row[user]
$row[content]
<?=$row[title]; ?>改为<?php echo $row['title']; ?><?这是短标签的写法,需要在php.ini中修改配置short_open_tag = On才行。
Notice: Undefined variable: row in D:\software\PHP\htdocs\list.php on line 12
这个我已经改过了short_open_tag = On。
include("conn.php");
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$sql="select * from message order by id desc";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
?>
<tr bgcolor="#eff3ff">
<td>标题:<?php echo $row['title']; ?>
用户:<?php echo $row['user']; ?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?php echo $row['content']; ?></td>
</tr>
<?
}
?>
</table>
include("conn.php");
?>
<table width=500 border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?php
$sql="select * from message order by id desc";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
?>
<tr bgcolor="#eff3ff">
<td>标题:<?php echo $row['title']; ?>
用户:<?php echo $row['user']; ?></td>
</tr>
<tr bgColor="#ffffff">
<td>内容:<?php echo $row['content']; ?></td>
</tr>
<?php
}
?>
</table>世界上怕就怕认真二字