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

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

WBOY
WBOYOriginal
2016-06-13 12:36:401116browse

如何获取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 />
?>

mysql php utf8 数据库
Statement:
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