How can I output the query results in an array? The following is the result 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 ....
Reply to discussion (solution)
While ($ row = mysql_fetch_array ($ SQL )){
$ Tmp [] = $ row [areaname];
}
$ Graph-> xaxis-> SetTickLabels ($ tmp );
While ($ row = mysql_fetch_array ($ SQL )){
$ Tmp [] = $ row [areaname];
}
$ Graph-> xaxis-> SetTickLabels ($ tmp );
You said the method is successful, but I want to do this report, the database encoding is GB2312 before reading said that the report median support UTF-8 encoding format, I have printed garbled characters. I want to change the encoding in this way, but the result is unsuccessful, please take a look at how to replace the code like this ....
while($row_1 = mysql_fetch_array($sql_1)){$tmp[] = $row_1[areaname];$array = iconv("GB2312","UTF-8","$tmp");}
Iconv can only be used for strings and is not applicable to arrays.
$ Tmp [] = iconv ("GB2312", "UTF-8", $ row_1 [areaname]);
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.
Of course you can.
$ Tmp [] = iconv ("GB2312", "UTF-8", $ row ['areame']);
Of course you can.
$ Tmp [] = iconv ("GB2312", "UTF-8", $ row ['areame']);
How is the code garbled? what's wrong...
Echo base64_encode ($ row ['areaname']);
Post result
Will it be the file storage format is not UTF-8, it is recommended to open a look
Echo base64_encode ($ row ['areaname']);
Post result
Result: [ILDZu6i088/clusters = Hybrid = wLa + qLTzz8M = Hybrid = yPOwsrTzz8M = Hybrid = xM ++ qdK7sr8 = xM ++ qbb + sr8 = ZGZzZmRm]
The key is that the report is like the X axis, the y axis, and the title are also read from the database, so they are not garbled, and the garbled code appears below...
Garbled. Use Notepad to open and save it as code to see if it is UTF-8.
Well, it's gbk.
It may be where I earned the code, or it may be that the font used is Spanish.
What is the page encoding format?
What is the page encoding format?
The page encoding format is GB2312. The key is the same page. The database uses the same encoding format. how can this problem be solved .....
Garbled. Use Notepad to open and save it as code to see if it is UTF-8.
It's okay to use notepad to open and save the code as GB2312.
Is the data table encoded in gb2312? is the data table encoded in the same way?
Is the data table encoded in gb2312? is the data table encoded in the same way?
All are consistent GB2312
This is strange. isn't the database data garbled?
This is strange. isn't the database data garbled?
Solve the problem. if garbled characters appear in general, add $ graph-> xaxis-> SetFont (FF_SIMSUN, FS_BOLD) for GB2312. The first parameter of SetFont method is FF_SIMSUN.
$ Title = iconv ("UTF-8", "gb2312", $ title)
I have seen it again.
This is strange. isn't the database data garbled?
Solve the problem. if garbled characters appear in general, add $ graph-> xaxis-> SetFont (FF_SIMSUN, FS_BOLD) for GB2312. The first parameter of SetFont method is FF_SIMSUN.
$ Title = iconv ("UTF-8", "gb2312", $ title)
Oh, so I have never met you. I am a long learner.