<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>生活在远方 &#187; mysql</title>
	<atom:link href="http://www.rsywx.net/wordpress/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rsywx.net/wordpress</link>
	<description>是的，因为真正的生活是在远方</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:55:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Titanium Developer学习笔记（二）</title>
		<link>http://www.rsywx.net/wordpress/2010/11/03/titanium-day-2/</link>
		<comments>http://www.rsywx.net/wordpress/2010/11/03/titanium-day-2/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 12:45:13 +0000</pubDate>
		<dc:creator>tr</dc:creator>
				<category><![CDATA[Titanium Developer]]></category>
		<category><![CDATA[编程、软件、技术]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://www.rsywx.net/wordpress/2010/11/03/titanium-day-2/</guid>
		<description><![CDATA[本文收录于[go4pro.org]。 这两天主要是学习如何将我之前编写的一些jQuery的demo迁移到Titanium里去，采用的编程模式是HTML+CSS+PHP+javascript (jQuery)，而不是Titanium本身的UI。 总体来说，过程不复杂，也很直观。大部分代码我只是修改了CSS文件和jQuery文件的位置就可以直接使用了。在这个过程中，有几个地方是我原来认为没有问题，却出了问题的。 首先是连接远程的MySQL。我用的主机是BlueHost，出于安全考虑，BH的主机缺省是不提供远程MySQL的连接的，需要用户加入可信任的IP地址（或地址段）后才可以。 BH提供了一个URI探测客户端的IP，同时在BH控制页面也会探测IP。我发现的第一个问题就是：这两个被探测出来的IP不仅不一样，而且是不对的！如果填入这两个IP，远程连接时还是报错！最终正确的IP是我的路由给出的IP。终于解决了这个问题。 第二个问题就是在Titanium里开始MySQL的连接。之前，我已经在PHP脚本状态编写了一些测试脚本来测试连接，并证明是可以的。但是同样的代码，在Titanium里进行编译并执行后，出现了如下的警告： Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected&#8230;. Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication&#8230;. Warning: mysql_select_db() expects parameter 2 to be resource, boolean given&#8230;. 这些问题的描述其实已经很直观了。在Google中搜索后发现，这个问题的解决需要在我的服务器端对MySQL服务进行配置，当然这个配置在目前我使用的BH主机下是无法实现的。我判断是因为Titanium在编译时使用了一些不正确的参数，并在Titanium论坛里进行了提问，但是到目前还没有回答。 我只能进行另外一种——可能是更正确，因为有“云”的味道——的做法，就是将数据提供部分抽取出来成为一个独立的脚本，然后在客户端脚本中获取返回的数据。具体代码就不提供了，因为不是很困难的代码。 我之所以不用jQuery的json方法获得这些数据，是因为我的客户端PHP脚本需要明确的获得数据后再进行处理。我不能冒异步的风险。]]></description>
			<content:encoded><![CDATA[<p>本文收录于<a href="http://www.go4pro.org">[go4pro.org]</a>。</p>
<p>这两天主要是学习如何将我之前编写的一些<a href="http://www.rsywx.net/jquery/demos/index.html">jQuery的demo</a>迁移到Titanium里去，采用的编程模式是HTML+CSS+PHP+javascript (jQuery)，而不是Titanium本身的UI。</p>
<p>总体来说，过程不复杂，也很直观。大部分代码我只是修改了CSS文件和jQuery文件的位置就可以直接使用了。在这个过程中，有几个地方是我原来认为没有问题，却出了问题的。</p>
<p><span id="more-2557"></span></p>
<p>首先是连接远程的MySQL。我用的主机是BlueHost，出于安全考虑，BH的主机缺省是不提供远程MySQL的连接的，需要用户加入可信任的IP地址（或地址段）后才可以。</p>
<p>BH提供了一个URI探测客户端的IP，同时在BH控制页面也会探测IP。我发现的第一个问题就是：这两个被探测出来的IP<strong>不仅不一样，而且是不对的！</strong>如果填入这两个IP，远程连接时还是报错！最终正确的IP是我的路由给出的IP。终于解决了这个问题。</p>
<p>第二个问题就是在Titanium里开始MySQL的连接。之前，我已经在PHP脚本状态编写了一些测试脚本来测试连接，并证明是可以的。但是同样的代码，在Titanium里进行编译并执行后，出现了如下的警告：</p>
<blockquote><p>Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected&#8230;.</p>
<p>Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication&#8230;.</p>
<p>Warning: mysql_select_db() expects parameter 2 to be resource, boolean given&#8230;.</p></blockquote>
<p>这些问题的描述其实已经很直观了。在Google中搜索后发现，这个问题的解决需要在我的服务器端对MySQL服务进行配置，当然这个配置在目前我使用的BH主机下是无法实现的。我判断是因为Titanium在编译时使用了一些不正确的参数，并在Titanium论坛里进行了<a href="http://developer.appcelerator.com/question/74881/a-remoted-mysql-connection-failed-authentication">提问</a>，但是到目前还没有回答。</p>
<p>我只能进行另外一种——可能是更正确，因为有“云”的味道——的做法，就是将数据提供部分抽取出来成为一个独立的脚本，然后在客户端脚本中获取返回的数据。具体代码就不提供了，因为不是很困难的代码。</p>
<p>我之所以不用jQuery的json方法获得这些数据，是因为我的客户端PHP脚本需要明确的获得数据后再进行处理。我不能冒异步的风险。</p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://www.rsywx.net/wordpress/2010/11/03/titanium-day-2/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.rsywx.net/wordpress/2010/11/03/titanium-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在MySQL中按照当地时间的时段、星期几统计</title>
		<link>http://www.rsywx.net/wordpress/2010/02/28/aggregating-based-on-local-time-weekday-in-mysql/</link>
		<comments>http://www.rsywx.net/wordpress/2010/02/28/aggregating-based-on-local-time-weekday-in-mysql/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 09:25:55 +0000</pubDate>
		<dc:creator>tr</dc:creator>
				<category><![CDATA[编程、软件、技术]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[local]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[timezone]]></category>
		<category><![CDATA[当地时间]]></category>
		<category><![CDATA[时区]]></category>
		<category><![CDATA[统计]]></category>

		<guid isPermaLink="false">http://www.rsywx.net/wordpress/?p=2135</guid>
		<description><![CDATA[缘起 BT群创建了一个基于status.net的话痨群。我一时手痒，做了个后台，进行一个基本的统计。比如：一天24个时段中每个时段的话痨数量、一周7天中每天的话痨数量等。 这些统计都是要用到基于时间的统计。 我先看了一下后台数据库，我们所使用的这个服务程序将“话痨”贴存放在notice表格中，用字段created来记录。不过它记录的是GMT时间（或者说UTC）时间。这个时间和北京时间存在着8个小时的时差，会造成时段统计的偏移和周内统计的偏移。例如，我在20号上午7点发的话痨，会被储存为19号23时发布的。 一开始，我是用调整服务程序的时区来解决的。虽然在部分程度上解决了“本站点”的问题，但是造成了其他各位BT使用的客户端无法正确获得时间的问题。这个后果是严重的。 解决方案 解决方案只能从MySQL里面去找。通过查阅MySQL参考手册，发现了这么个函数： CONVERT_TZ(dt,from_tz,to_tz) 通过这个函数就可以将一个时区的时间转换到另外一个时间。 于是，相应的按照时段统计的SQL语句就是： SELECT COUNT&#40;*&#41; nc, HOUR&#40;convert_tz&#40;created, '$stz','$etz' &#41;&#41; dh FROM notice GROUP BY dh 其中的$stz和$etz是两个时区的时间偏移。在本程序中，用的是&#8217;+00:00&#8242;和&#8217;+08:00&#8242;。 经过调试，成功！ 题外话 在CodeIgniter中，如果使用内置的helper函数来生成SQL语句，那么会不成功。提示生成的SQL有错误，或者是找不到&#8217;+00:00&#8242;这个字段。 解决方法是，改写model中的查询过程为： public function getNoticeCountHour&#40;&#41; &#123; $stz='+00:00'; $etz='+08:00'; &#160; $selectsql=&#34;select count(*) nc, hour(convert_tz(created, '$stz','$etz' )) dh from notice group by dh&#34;; &#160; //下面的代码无法执行 //$this-&#62;db-&#62;select(&#34;count( *  ) nc, hour(convert_tz(created, '$stz','$etz' ) [...]]]></description>
			<content:encoded><![CDATA[<p><strong>缘起</strong></p>
<p>BT群创建了一个基于status.net的话痨群。我一时手痒，做了个后台，进行一个基本的统计。比如：一天24个时段中每个时段的话痨数量、一周7天中每天的话痨数量等。</p>
<p>这些统计都是要用到基于时间的统计。</p>
<p>我先看了一下后台数据库，我们所使用的这个服务程序将“话痨”贴存放在notice表格中，用字段created来记录。不过它记录的是GMT时间（或者说UTC）时间。这个时间和北京时间存在着8个小时的时差，会造成时段统计的偏移和周内统计的偏移。例如，我在20号上午7点发的话痨，会被储存为19号23时发布的。</p>
<p>一开始，我是用调整服务程序的时区来解决的。虽然在部分程度上解决了“本站点”的问题，但是造成了其他各位BT使用的客户端无法正确获得时间的问题。这个后果是严重的。</p>
<p><strong>解决方案</strong></p>
<p>解决方案只能从MySQL里面去找。通过查阅MySQL参考手册，发现了这么个函数：</p>
<blockquote><p><a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_convert-tz">CONVERT_TZ(dt,from_tz,to_tz)</a></p></blockquote>
<p>通过这个函数就可以将一个时区的时间转换到另外一个时间。</p>
<p>于是，相应的按照时段统计的SQL语句就是：</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">COUNT</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">*</span><span style="color: #66cc66;">&#41;</span> nc<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">HOUR</span><span style="color: #66cc66;">&#40;</span>convert_tz<span style="color: #66cc66;">&#40;</span>created<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'$stz'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'$etz'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> dh <span style="color: #993333; font-weight: bold;">FROM</span> notice <span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> dh</pre></div></div>

<p>其中的$stz和$etz是两个时区的时间偏移。在本程序中，用的是&#8217;+00:00&#8242;和&#8217;+08:00&#8242;。</p>
<p>经过调试，成功！</p>
<p><strong>题外话</strong></p>
<p>在CodeIgniter中，如果使用内置的helper函数来生成SQL语句，那么会不成功。提示生成的SQL有错误，或者是找不到&#8217;+00:00&#8242;这个字段。</p>
<p>解决方法是，改写model中的查询过程为：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getNoticeCountHour<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$stz</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'+00:00'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$etz</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'+08:00'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$selectsql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;select count(*) nc, hour(convert_tz(created, '<span style="color: #006699; font-weight: bold;">$stz</span>','<span style="color: #006699; font-weight: bold;">$etz</span>' )) dh from notice group by dh&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//下面的代码无法执行</span>
    <span style="color: #666666; font-style: italic;">//$this-&gt;db-&gt;select(&quot;count( *  ) nc, hour(convert_tz(created, '$stz','$etz' ) ) dh&quot;);</span>
    <span style="color: #666666; font-style: italic;">//$this-&gt;db-&gt;group_by('dh');</span>
    <span style="color: #666666; font-style: italic;">//$q=$this-&gt;db-&gt;get('notice');</span>
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$selectsql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">result</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>这个应该是CodeIgniter的问题。暂时没有时间去搞了。</p>
<p>另外，根据MySQL的文档，使用了convert_tz函数后，这个查询将不能被缓存，会影响执行效率。</p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://www.rsywx.net/wordpress/2010/02/28/aggregating-based-on-local-time-weekday-in-mysql/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.rsywx.net/wordpress/2010/02/28/aggregating-based-on-local-time-weekday-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>八月十七日</title>
		<link>http://www.rsywx.net/wordpress/2007/08/17/%e5%85%ab%e6%9c%88%e5%8d%81%e4%b8%83%e6%97%a5/</link>
		<comments>http://www.rsywx.net/wordpress/2007/08/17/%e5%85%ab%e6%9c%88%e5%8d%81%e4%b8%83%e6%97%a5/#comments</comments>
		<pubDate>Fri, 17 Aug 2007 12:17:11 +0000</pubDate>
		<dc:creator>tr</dc:creator>
				<category><![CDATA[太宗本纪]]></category>
		<category><![CDATA[编程、软件、技术]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://www.rsywx.net/wordpress/?p=188</guid>
		<description><![CDATA[是日，上于股市继续保持受挫状态。终于出现红字。 下午与太子一起去邻里中心学习拼音，却带错了练习本无法练习写拼音。 回家后，上开始钻研两个问题： 首先是实践一下Smarty模板。这个没有碰到多大的问题就解决了。这里就是一个很好的DEMO。 其次是上突发奇想，想测试一下以前做过的一个XAJAX的DEMO，测试一下如果数据库中有中文时，输入中文是否也能顺利触发Auto Completion的功能。 就是这个看起来一般的问题，让我花费了差不多40分钟的之间去解决。开始我是怀疑OnKeyUp事件对中文输入不起作用，但是做了一个小的测试后发现不是 这么回事。输入的中文可以触发OnKeyUp事件。于是将注意力集中到数据库查询上。先是怀疑我构造的SQL语句无法搜索中文，但是在 PHPMYADMIN中测试后发现SQL语句是正确的。 于是，这才将注意力集中到字符集上来了。 在搜索SQL之前插入如下两句SQL语句后，再次执行，果然该发生的终于发生了： $dummy="set names utf8"; mysql_query($dummy, $conn); 这个问题说穿了还是MySQL返回字符串时使用的字符集的问题。这个问题我在之前的文章中已经描述过了，今天的解决方法还是完全一样。短短一个多月，我就忘记了这个问题，真是强烈的874自己。所以再次将这个问题写出来，再次的提醒自己。]]></description>
			<content:encoded><![CDATA[<p>是日，上于股市继续保持受挫状态。终于出现红字。</p>
<p>下午与太子一起去邻里中心学习拼音，却带错了练习本无法练习写拼音。</p>
<p>回家后，上开始钻研两个问题：<br />
<span id="more-188"></span></p>
<ul>
<li>首先是实践一下Smarty模板。这个没有碰到多大的问题就解决了。<a href="http://www.rsywx.net/misc/lakers.php?year=2007">这里</a>就是一个很好的DEMO。</li>
<li>其次是上突发奇想，想测试一下以前做过的<a href="http://www.rsywx.net/xajax/test07.php">一个XAJAX的DEMO</a>，测试一下如果数据库中有中文时，输入中文是否也能顺利触发Auto Completion的功能。</li>
</ul>
<p><!--更多--></p>
<p>就是这个看起来一般的问题，让我花费了差不多40分钟的之间去解决。开始我是怀疑OnKeyUp事件对中文输入不起作用，但是做了一个小的测试后发现不是 这么回事。输入的中文可以触发OnKeyUp事件。于是将注意力集中到数据库查询上。先是怀疑我构造的SQL语句无法搜索中文，但是在 PHPMYADMIN中测试后发现SQL语句是正确的。</p>
<p>于是，这才将注意力集中到字符集上来了。</p>
<p>在搜索SQL之前插入如下两句SQL语句后，再次执行，果然该发生的终于发生了：</p>
<pre>$dummy="set names utf8";
mysql_query($dummy, $conn);</pre>
<p>这个问题说穿了还是MySQL返回字符串时使用的字符集的问题。这个问题我在<a href="http://www.rsywx.net/wordpress/?p=131">之前的文章</a>中已经描述过了，今天的解决方法还是完全一样。短短一个多月，我就忘记了这个问题，真是强烈的874自己。所以再次将这个问题写出来，再次的提醒自己。</p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://www.rsywx.net/wordpress/2007/08/17/%e5%85%ab%e6%9c%88%e5%8d%81%e4%b8%83%e6%97%a5/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.rsywx.net/wordpress/2007/08/17/%e5%85%ab%e6%9c%88%e5%8d%81%e4%b8%83%e6%97%a5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>从MySQL中获取中文数据</title>
		<link>http://www.rsywx.net/wordpress/2007/07/12/%e4%bb%8emysql%e4%b8%ad%e8%8e%b7%e5%8f%96%e4%b8%ad%e6%96%87%e6%95%b0%e6%8d%ae/</link>
		<comments>http://www.rsywx.net/wordpress/2007/07/12/%e4%bb%8emysql%e4%b8%ad%e8%8e%b7%e5%8f%96%e4%b8%ad%e6%96%87%e6%95%b0%e6%8d%ae/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 00:10:42 +0000</pubDate>
		<dc:creator>tr</dc:creator>
				<category><![CDATA[编程、软件、技术]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.rsywx.net/wordpress/?p=131</guid>
		<description><![CDATA[今天测试了一下从MySQL中获得中文数据，发现需要进行一些处理才能在网页中完美显示中文（在PHPMYADMIN中插入、显示是正常的）： 首先，当然是你的MySQL数据库是基于UTF-8建立的。 然后是在PHP中的常规连接： $hostname_test = &#8220;localhost&#8221;; $database_test = &#8220;test&#8221;; $username_test = &#8220;root&#8221;; $password_test = &#8220;xxxxxx&#8221;; $test = mysql_pconnect($hostname_test, $username_test, $password_test) or trigger_error(mysql_error(),E_USER_ERROR); $query=&#8221;select * from chinese&#8221;; mysql_select_db($database_test, $test); $xx=&#8221;set names utf8&#8243;; mysql_query($xx); $rs=mysql_query($query, $test); while($row=mysql_fetch_object($rs)) { echo $row-&#62;id.&#8221;&#60;br/&#62;&#8221;; echo $row-&#62;desc.&#8221;&#60;br/&#62;&#8221;; echo &#8220;=====================&#60;br/&#62;&#8221;; } 注意上面的黑体部分，这两行很关键。 再然后是在PHP文件中要指定字符集： &#60;head&#62; &#60;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&#62; &#60;/head&#62; 注意，这里要写utf-8，而set names时要写utf8。]]></description>
			<content:encoded><![CDATA[<p>今天测试了一下从MySQL中获得中文数据，发现需要进行一些处理才能在网页中完美显示中文（在PHPMYADMIN中插入、显示是正常的）：</p>
<p><span id="more-131"></span></p>
<p>首先，当然是你的MySQL数据库是基于UTF-8建立的。</p>
<p>然后是在PHP中的常规连接：</p>
<blockquote><p>$hostname_test = &#8220;localhost&#8221;;<br />
$database_test = &#8220;test&#8221;;<br />
$username_test = &#8220;root&#8221;;<br />
$password_test = &#8220;xxxxxx&#8221;;<br />
$test = mysql_pconnect($hostname_test, $username_test, $password_test) or trigger_error(mysql_error(),E_USER_ERROR);</p>
<p>$query=&#8221;select * from chinese&#8221;;</p>
<p>mysql_select_db($database_test, $test);<br />
<strong> $xx=&#8221;set names utf8&#8243;;<br />
mysql_query($xx);</strong></p>
<p>$rs=mysql_query($query, $test);<br />
while($row=mysql_fetch_object($rs))<br />
{<br />
echo $row-&gt;id.&#8221;&lt;br/&gt;&#8221;;<br />
echo $row-&gt;desc.&#8221;&lt;br/&gt;&#8221;;<br />
echo &#8220;=====================&lt;br/&gt;&#8221;;<br />
}</p></blockquote>
<p>注意上面的黑体部分，这两行很关键。</p>
<p>再然后是在PHP文件中要指定字符集：</p>
<blockquote><p>&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&gt;<br />
&lt;/head&gt;</p></blockquote>
<p>注意，这里要写utf-8，而set names时要写utf8。</p>
<div style="float:left;margin:0px 0px 0px 0px;"><a title="Post on Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count" data-url="http://www.rsywx.net/wordpress/2007/07/12/%e4%bb%8emysql%e4%b8%ad%e8%8e%b7%e5%8f%96%e4%b8%ad%e6%96%87%e6%95%b0%e6%8d%ae/"></a><script type="text/javascript" src="http://www.google.com/buzz/api/button.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://www.rsywx.net/wordpress/2007/07/12/%e4%bb%8emysql%e4%b8%ad%e8%8e%b7%e5%8f%96%e4%b8%ad%e6%96%87%e6%95%b0%e6%8d%ae/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

