Php export non-gibberish, non-disordered, and amazing problem. please be frustrated and help me.

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.