我正在尝试从数据库中获取价值,这是我的代码:
function client() {
$code=$_GET['actvcode'];
$db = mysql_connect('localhost','root','0000');
if (!$db) die("Error connecting to MySQL database.");
mysql_query('SET NAMES utf8');
mysql_select_db("test" ,$db);
$query = 'SELECT client FROM cmum_codes WHERE code="'. mysql_real_escape_string( $code ) .'"';
if (!($result = @mysql_query($query))) {
die(mysql_error());
}
$str = $result;
return $str;
}
我总是得到“数组”这个词,这是怎么回事?