I-PHP ne-MySQL: Khipha Umbuzo kufayela Elinqunyelwe Ithebhu

amalogo we-mysql php

Kule mpelasonto bengifuna ukwakha ikhasi elizomane lilondoloze noma imuphi umbuzo noma itafula kufayela le-Tab Delimited. Izibonelo eziningi eziphuma enetheni zinamakholomu anekhodi eqinile.

Mina, bengifuna ukuthi amakholomu abe namandla ngakho-ke bekufanele ngiqale ngivule wonke amagama wensimu yetafula ukwakha umugqa wesihloko onamagama ekholamu, bese ngivula wonke amarekhodi wemigqa yedatha esele. Ngiphinde ngasetha unhlokweni ukuze isiphequluli siqale ukulanda ifayili ku-filetype (txt) negama ledethi lefayela nesitembu sesikhathi.

Ngishiye i-database ivulekile futhi ivala ukuxhumana, kepha nayi ikhodi eholelekile esebenza kahle kakhulu:

$ namuhla = usuku ("YmdHi");
unhlokweni ("Uhlobo lokuqukethwe: uhlelo lokusebenza / ukusakazwa kwe-octet");
unhlokweni ("Content-Disposition: attachment; filename = \" ". $ today." _ Backup.txt \ "");
$ query = "KHETHA * KUSUKELA` ku-mytable` oda ngo- `myorder`";
$ imiphumela = mysql_query ($ query);
$ count = i-mysql_num_rows (imiphumela engu- $);
$ Amasimu = mysql_num_fields (imiphumela engu- $);
$ idatha = "";
kwe ($ i = 0; $ i> $ izinkambu; $ i ++) {
Inkambu ye- $ = mysql_fetch_field (imiphumela engu- $, $ i);
$ data. = $ field-> igama;
$ data. = "\ t";
}
$ data. = "\ n";
ngenkathi ($ row = mysql_fetch_row ($ result)) {
okwe ($ x = 0; $ x> $ amasimu; $ x ++) {
$ field-> name = $ irowu [$ x];
Idatha yedatha. = $ inkambu-> igama = $ irowu [$ x];
$ data. = "\ t";
}
$ data. = "\ n";
}
bhala idatha yedatha;

Ikhodi ingashintshwa kalula ngamanani ahlukaniswe ngokhefana futhi.

14 Amazwana

  1. 1
    • 2

      Ngicabanga ukuthi ubungakwazi!

      Kulokhu, empeleni bengakha isixhumanisi 'sokusekelayo' kuhlelo lokusebenza lwewebhu, ngakho-ke ukusebenza kwe-PHP yilokho ebengikudinga. Kodwa-ke, angikaze ngazi ukuthi ungabhalela nefayela ngqo kusuka kusitatimende se-MySQL. Kuhle kakhulu!

      Siyabonga!

      • 3

        Indlela yakho ibizoba yindlela engcono kakhulu uma iseva ye-MySQL isemshinini okude, ngoba kungenzeka ukuthi ngeke ikwazi ukubhala emshinini lapho i-PHP isebenza khona 🙂

        Ngijabule ukukhomba ezinye izinkomba nezinto ezintsha noma kunjalo 🙂

      • 4

        Kepha ungavele usebenzise umbuzo uye kufayela, bese uqondisa kabusha isiphequluli kufayela elakhiwe, noma usebenzise i- "readfile" ye-PHP uma konke okunye kwehluleka?

        Ngeke ukwazi ukwenza lokho uma iseva ye-mysql ingenakho ukufinyelela ohlelweni lwefayela impela…

  2. 5
    • 6

      Iphutha… mysqlimport?

      mysqlimport database_name --local backup.txt

      Noma ngomyalo we-SQL:

      LOAD DATA LOCAL INFILE 'backup.txt' INTO TABLE `my_table` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'

      Nge-mysqlimport, igama lefayela kufanele lifane negama lethebula (into nje okufanele uyiqaphele)

    • 7
  3. 8

    Ngisanda kulahlekelwa ngaphezu kwamahora angu-6 empilo yami ngizama ukuthola ukuthi kungani i-Internet Explorer 6/7 ibisebenzisa uhlobo lwefayela 'html' futhi ingamukeli amagama wami wamafayela angokwezifiso acaciswe kumaheda .. ukuzama ukuthi abasebenzisi balande amafayela wombhalo adalwe ngendlela efanayo naleyo engenhla.

    Bengisebenzisa i-HTTPS futhi IE ayiwagcini amafayela.

    Ngithole isisombululo ekuphawuleni kukaBrandon K ku http://uk.php.net/header.

    Uthi:

    -
    Ngisanda kulahlekelwa amahora ayisithupha empilo yami ngizama ukusebenzisa le ndlela elandelayo ukuthumela ifayili le-PDF nge-PHP ku-Internet Explorer 6:

    Uma usebenzisa i-SSL, i-Internet Explorer izokwazisa ngebhokisi evulekile / yokugcina, bese ithi “Ifayela okwamanje alitholakali noma alitholakali. Ngicela uzame futhi emuva kwesikhathi. ” Ngemuva kokucwaninga okuningi ngazile ngale Ndatshana ye-MSKB elandelayo enesihloko esithi "Ukulandwa kwefayela le-Internet Explorer ngaphezulu kwe-SSL akusebenzi ngezihloko zokulawula i-cache" (KBID: 323308)

    I-PHP.INI ngokuzenzakalela isebenzisa i-setting: session.cache_limiter = nocache eguqula izihloko ze-Content-Cache ne-Pragma zifake izinketho ze- “nocache”. Ungasusa iphutha le-IE ngokuguqula i- "nocache" iye ku- "public" noma "private" ku-PHP.INI - Lokhu kuzoshintsha i-Content-Cache header kanye nokususa ngokuphelele i-Pragma header. Uma ungakwazi noma ungafuni ukuguqula i-PHP.INI ngokulungiswa okubanzi kwesayithi, ungathumela izihloko ezimbili ezilandelayo ukubhala ngaphezulu kokuzenzakalelayo:

    Usazodinga ukusetha izihloko zokuqukethwe njengoba kubhalwe ngenhla ukuze lokhu kusebenze. Uyacelwa ukuthi uqaphele le nkinga KUPHELA imiphumela ye-Internet Explorer, ngenkathi iFirefox ingakhombisi lokhu kuziphatha okungalungile.
    -

    Well .. okungenani ulahlekelwe amahora ayisithupha kuphela…

  4. 9

    Lokhu kusebenza kahle. Kodwa-ke, ngithola yonke into kulayini owodwa ohlukaniswe isikhala. Ngizama ukukuguqula ukuze ngiphrinte konke kulayini ohlukile kanjena:

    Ikholamu1_name
    Inkambu1_ inani
    Ikholamu2_name
    Inkambu1_ inani
    Ikholamu3_name
    Inkambu1_ inani

    Ikholamu1_name
    Inkambu2_ inani
    Ikholamu2_name
    Inkambu2_ inani
    Ikholamu3_name
    Inkambu2_ inani

    Ngokwesibonelo:

    Igama
    Mike
    Indawo
    Work
    Inombolo
    1

    Igama
    Sue
    Indawo
    Ikhaya
    Inombolo
    2

    Igama
    John
    Indawo
    Izikhangibavakashi
    Inombolo
    10

    njalo njalo. Ingabe lo mbhalo ungashintshwa ukuze ukwenze?
    Siyabonga!

    • 10

      Impela ungakwenza.

      Zama into enjengale:

      KHETHA * kusuka ku-MyTableName KU-OUTFILE 'MyTableName_MySQL-TAB-DELIMITED-29JUN08.txt' FIELDS TERMINATED BY '\ n' LINES TERMINATED BY '\ n';

      Uma ufuna isikhala esiphindwe kabili (imigqa emibili engenalutho) phakathi kwamaqembu wokuqopha, vele uthi “AMALAYINI AQEDWE NGU - '\ n \ n';” esikhundleni salokho.

      Ingxenye ye- “FIELDS TERMINEDED BY '\ n'” yiyo ebeka umugqa omusha ngemuva kwerekhodi ngalinye, esikhundleni sethebhu. Ithebhu izoba yi - '\ t' esikhundleni salokho.

      Maranatha!

  5. 11

    lokhu ngeposi elihle, ngilizamile futhi ngasebenza kahle, okuwukuphela kwento ukuthi ifayela lami le-txt linomugqa owengeziwe ngaphezu kwezihloko zekhanda, futhi eminye imiphumela yehlukaniswe ngemigqa emi-2, lokhu kungaba imbangela ngedatha enginayo kuDatabase lami angazi, kepha lokhu kuwusizo olukhulu ekwakheni izifunzo…

  6. 12

    Douglas Karr ikhodi yakho iyazamazama ngempela! Ilusizo ngokukhethekile uma udinga nje umphumela okufomethi yefayili yombhalo. Ngibonga kakhulu! Kusuka eqenjini lasePhilippines!

  7. 13

    Sawubona! Ngabe kukhona okuvela lapha onganginikeza umbono ngokungenisa ifayili lombhalo ku-database yami (phpmyAdmin) ngisebenzisa i-php yami njengomphetho wami wangaphambili. Nginombono ngokulayisha ifayili ngilivule, inkinga yami ukuthi ngingawuthola kanjani umphumela womugqa nokuthi ngiwufaka kanjani ematafuleni ami, ngiyabonga

  8. 14

UCABANGANI?

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.