Home > Backend Development > PHP Tutorial > 怎么获取mysql中枚举类型的值呢

怎么获取mysql中枚举类型的值呢

WBOY
Release: 2016-06-13 12:36:40
Original
1118 people have browsed it

如何获取mysql中枚举类型的值呢?
Array ( [0] => 1 [1] => storylok [2] => lele1989 [3] => ? )
为什么获取到的这个枚举类型是问号呢? 我在mysql控制台看的确是中文字呢。 字符集PHP和mysql都是utf8,怎么获取到这个枚举类型的值。

<?php<br />
header ( "Content-Type:text/html; charset=utf-8" ); <br />
$host = "localhost";<br />
$user = "root";<br />
$password = "";<br />
@$conn = mysql_connect($host,$user,$password) or die("数据库连接失败,请检查数据库配置!" . mysql_error());<br />
<br />
$tableName = "viuoo";<br />
mysql_select_db($tableName,$conn) or die('数据库表选择出错,请检查数据库表名是否正确!');<br />
mysql_query("SET NAMES 'utf-8'");<br />
$dm = "SELECT * FROM  user";<br />
$result = mysql_query($dm,$conn);<br />
while($res = mysql_fetch_row($result)){<br />
	print_r($res);<br />
	}<br />
<br />
?>
Copy after login

mysql php utf8 数据库
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template