Php export non-garbled and non-disordered query. please try again. help me. The first figure above is exported, and the second figure is the actual data of the database, careful friends found that the last three digits of the exported graph were all 0.
Please kindly advise
The code is as follows:
Multi_query ('Call UP_User_GetCardInfo ("'. $ condition. '","'. $ page. '"," 900000 ")') or die ($ mysqli-> error); $ query = $ mysqli-> store_result (); while ($ record = mysqli_fetch_array ($ query, MYSQLI_BOTH) {$ phone = $ record ['phone']; $ cardid = $ record ['cardid']; $ charge = $ record ['charge']; $ achieve = $ record ['achieve ']; $ chgdate = $ record ['usedate']; echo "\ n"; echo $ phone. "\ t"; echo $ cardid. "\ t"; echo $ charge. "\ t" ; Echo $ achieve. "\ t"; echo $ chgdate. "\ t";} if (is_object ($ query) $ query-> free_result (); $ mysqli-> next_result ();?>
Reply to discussion (solution)
No one!
The same effect is achieved using another method. the code is as follows:
$ Val) {$ title [] = $ key; $ field [] = $ val ;}#$ query = $ mysqli-> query ("select uid, username, phone from ccna_members limit 10 ") or die ($ mysqli-> error); # $ query = $ mysqli-> multi_query (" select * from ccna_members limit 10 ") or die ($ mysqli-> error); $ query = $ mysqli-> multi_query ($ _ SESSION ["exp_ SQL"]) or die ($ mysqli-> error ); $ query = $ mysqli-> store_result (); // $ csv_data = array ('uid', 'Username'); // All records are stored in this La $ csv_data = array (); // Press the header and place the field in the first line for ($ I = 0; $ I <count ($ field ); $ I ++) {$ csv_data [0] [$ I] = $ field [$ I];} while ($ row = mysqli_fetch_array ($ query, MYSQLI_BOTH )) {// array_push ($ csv_data, array ($ row [0], $ row ['username']); $ row_array = array (); for ($ I = 0; $ I <count ($ title); $ I ++) {# array_push ($ row_array, iconv ("UTF-8", "gb2312 ", $ row [$ title [$ I]); array_push ($ row_array, $ row [$ title [$ I]);} array_push ($ c Sv_data, $ row_array);} exportToCsv ($ csv_data, $ _ SESSION ["exp_filename"]. ". csv");?>
Echo $ cardid. "\ t ";
Change
Echo "'$ cardid \ t ";
Echo $ cardid. "\ t ";
Change
Echo "'$ cardid \ t ";
Still the same. no. Thank you for your answer.
How is it possible that you generate a text file with different suffixes?
Can I add your button?
How is it possible that you generate a text file with different suffixes?
You can change it to echo "$ cardid \ t"; or not. I don't know why.
"'$ Cardid \ t ";
There is a single quotation mark
Yes, you may not be able to see the word clearly if it is too small.
"'$ Cardid \ t ";
There is a single quotation mark
Yes, you may not be able to see the word clearly if it is too small.
Thank you. Paste to score
? String.