mam v databazi jmeno a u nej cislo...
jak je ma seradit podle velikosti toho cisla..treba do dvojrozmerny pole..nebo klidne i nejak jinak..prote seradit a pak vytisknout...
Printable View
mam v databazi jmeno a u nej cislo...
jak je ma seradit podle velikosti toho cisla..treba do dvojrozmerny pole..nebo klidne i nejak jinak..prote seradit a pak vytisknout...
Kód:SELECT name FROM table ORDER BY number
a kdyby to nebylo z databaze ale votviral by sem treba dvacet souboru kde by bylo to cislo ktery bych z toho dostal spolecne snickem a pak nejak seradit??
Mas vic variant, bud to nejdriv (v lepsim pripade) natlacis cely do RAMeti, do nejakyho pole a pak pouzijes nejspis quicksort (implementace viz google), pripadne v horsim pripade to budes tridit do nakyho tmp souboru.Citace:
Původně odeslal Miiisa
BTW: Tohle sou ovsem uplny zaklady prgani, s timhle by sis mel poradit i bez dotazu tu na 4u. A pracovat dneska s daty bez DB ?
ja vim..ale databazi nemuzu pouzit...
taham to pokazdy z textaku z jinyho serveru...z vice textaku...
no..premejslel sem jak to udelat ale napadaly me samy strasne slozity postupy..
podivam se na to trideni pole...
z tech "humpolactejsich" pristupu:
http://cz.php.net/manual/en/function.usort.php a pod.
ale pokud tech dat neni joooo moc, tak je to myslim celkem v pohode.
Slozity??? proste pouzijes jednu fci v PHP na nacteni souboru do pole(je jich vic, dle typu plneni pole), a pak si vyberes z hafa fci na trideni pole, co ti PHP nabizi ;) ... kde je slozitost? ;)Citace:
Původně odeslal Miiisa
no jasne..takhle uz to je fcelku jednoduchy, ja jen nevedel ze existuje neco jako funkce pro trideni poli....Citace:
Původně odeslal Arteee
>:E :evil: :lol:Citace:
Původně odeslal KtK
tohle vypada jako to co hledam..Thanks a lot...Citace:
Původně odeslal KtK
hmmm...tak asi ne...tak sem to asi blbe formuloval....a tim dvojrozmernym polem to asi nepude jak tak koukam...
upresnim dotaz...
mam x takovejhle hodnot
1234 AAA
2365 Hni
5697 aser
6982 asft
a ty potrebuju seradit podle toho cisla...
takze to asi dvojrozmernym polem nepude co???
ale pujde
http://cz.php.net/manual/en/function.explode.php
schvalne ti sem nebudu psat kompletni kod, tak se snaz ;)
explode jen rozdeli string.... to neni problem.ja to budu mit ve dvou promennejch...
tak ja to du teda zkusit...
tak sem to zmaknul 8-)
pomoci arsort a asociativniho pole....
//EDIT: taky me prekvapilo ze ot trii maximalne sestimistny (nebo ze by 5ti ??? ) cisla...
to je divne, ze jen 5 mistne..
urcite porovnavas cisla (int) a ne stringy? protoze "2" je pochopitelne vetsi nez "19"..
pokud stringy, budto si je zarovnej zleva nulama, nebo je preved na inty (intval())
ha..to bude asi vono..je to string...tak to schalvne udelam..diky...to sem netusil ze ot taky takhle je...Citace:
Původně odeslal KtK