How can I output the query results in an array .... the following are the results I want to achieve... $ graph-& gt; xaxis-& gt; SetTickLabels (array ('runan mansion ', 'baihua mansion', 'jinmeng mansion ', 'hengfeng mansion', 'huayi mansion ', 'Blue Whale Tower ', 'GG', 'DD', 'FF ', 'hh', 'KK ', 'FF', 'rr ','t how to output the query results in the form of arrays ....
The following are the results I want to achieve...
$ Graph-> xaxis-> SetTickLabels (array ('runan mansion ', 'baihua mansion', 'Golden dream mansion ', 'hengfeng mansion', 'huayi mansion ', 'Blue Whale mansion ', 'GG ', 'DD', 'ff', 'hh', 'KK ', 'ff', 'rr', 'TT ',));
I want to use
$query_1 = "select * from tbl_area";
$sql_1 = mysql_query($query_1);
$row_1 = mysql_fetch_array($sql_1);
In this way, the query results are as follows: 'runan mansion ', 'baihua mansion', 'jinmeng mansion ', 'hengfeng mansion', 'huayi mansion ', 'Blue Whale mansion', 'GG ', 'DD', 'ff', 'hh ', 'KK', 'FF ', 'rr', and 'TT'. how can this problem be achieved when printed, I tried
while ($row = mysql_fetch_array($sql)){echo "'".$row[areaname]."'".",";}
Loop out, but the result is an error when it is embedded .... share To: xaxis-> SetTickLabels (array ('runan mansion ', 'baihua mansion', 'Golden dream mansion ', 'hengfeng mansion', 'huayi mansion ', 'Blue Whale... 'data-pics = ''>
------ Solution --------------------
While ($ row = mysql_fetch_array ($ SQL )){
$ Tmp [] = $ row [areaname];
}
$ Graph-> xaxis-> SetTickLabels ($ tmp );
------ Solution --------------------
Iconv can only be used for strings and is not applicable to arrays.
$ Tmp [] = iconv ("GB2312", "UTF-8", $ row_1 [areaname]);
------ Solution --------------------
Run
Mysql_query ('set names utf8 ');
In this way, the result of your query is UTF-8, and you do not need to transcode it yourself. mysql will do it for you.
------ Solution --------------------
Garbled. Use Notepad to open and save it as code to see if it is UTF-8.