我正在从MySQL获取数据到一个页面,我不知道如果我这样做的方式是适当的。我无法将值提取到页面的各个部分。MYSQL获取行到页面
<?php
// Connect to database server
mysql_connect("localhost", "xxx", "xxx") or die (mysql_error());
// Select database
mysql_select_db("xxx") or die(mysql_error());
// SQL query
$strSQL = "SELECT * FROM news";
// Execute the query (the recordset $rs contains the result)
$rs = mysql_query($strSQL);
// Loop the recordset $rs
// Each row will be made into an array ($row) using mysql_fetch_array
while($row = mysql_fetch_array($rs)) {
// Write the value of the column FirstName (which is now in the array $row)
echo $row['editor_name'] . " " . $row['news_desc'];
echo "<br />";
}
// Close the database connection
mysql_close();
?>
</div> <!-- content #end -->
该数据库;
上述收益率;
我要做到以下几点; BY:法迪
echo 'BY' $row['editor_name'] . " " . $row['news_desc'];
echo "<br />";
,但它不工作:(任何提示
搜索 “PHP的MySQL的字符集UTF-8” 的[UTF-8一路过关斩将] – dynamic 2012-04-01 20:18:34
可能重复(http://stackoverflow.com/问题/ 279170/utf-8-all-the-way-through) – dynamic 2012-04-01 20:18:53
'echo'BY'$ row ['editor_name']。 “”。 $行[ 'news_desc'];回声“
”;'应该'回声'BY'。 $ row ['editor_name']。 “”。 $行[ 'news_desc'];回声“
”;' – Jack 2012-04-01 20:24:55