swf Posted August 24, 2005 Report Share Posted August 24, 2005 Man Ir tabula ar kolonnaam: |___ Andris___ |___ Juris___ |___ Peeteris___ | un ar shuunaam tel: piemeeram katram no vinjiem ir piem daudz telefonu numuru Lai nebuutu katram kaada konkreetaa lapas izvietojuma daljaa jaraksta querijs, droshi ven labaak ir samochiit visu no viena querija masiivaa un peec tam izvadiit ar foreach funkciju vai taml. Bet nevaru saprast kaa.. Vajag taa lai vaards buutu atseviski no paareejaa un zem taa tel. numuri.. Pagaidaam izvads izkataas shaadi: Andris - 58465454; Andris - 57545732; Andris - 99874555; Andris - 77965858; Juris - 5554656; Juris - 54654535; Peeteris - 4224454535; a vajadzeetu: Andris 58465454 57545732 99874555 77965858 tad kaut kur citur lapaa: Juris 654564654 546546548 ps. nekad taa iipashi neesmu njeemies ar massiiviem tapee arii esu taads duraks Link to comment Share on other sites More sharing options...
Delfins Posted August 24, 2005 Report Share Posted August 24, 2005 Kurš tev mācīja DB struktūru veidot? :blink: Link to comment Share on other sites More sharing options...
swf Posted August 24, 2005 Author Report Share Posted August 24, 2005 BAAC TU NESKATIES UZ TO TABULU TAS IR TIKAI PIEMEERS man ir vitaali svariigi zinaat kaa vienaa masiivaa dabuut iekshaa vaardu un piesaistiit tam veel numurus. vai to var visu sabaazt vienaa daudzdimensionaalajaa masiivaa, bet varbuut ir kaads labaaks risinaajums? Link to comment Share on other sites More sharing options...
swf Posted August 24, 2005 Author Report Share Posted August 24, 2005 iisteniibaa man ir 3 tabulas- viena ir vaardi, otraa numuri un treshaa ir relaaciju tabula ja kas Link to comment Share on other sites More sharing options...
Delfins Posted August 24, 2005 Report Share Posted August 24, 2005 rupji sakot, "bļe", tad tev atbildi dot uz 1 tabulu vai trīm !? :huh: Link to comment Share on other sites More sharing options...
hu_ha Posted August 24, 2005 Report Share Posted August 24, 2005 a manuālī vispār ieskatījies? http://lv.php.net/manual/en/ref.mysql.php pirmais piemērs vai precīzāk http://lv.php.net/manual/en/function.mysql-fetch-array.php Link to comment Share on other sites More sharing options...
Delfins Posted August 24, 2005 Report Share Posted August 24, 2005 $fields = Array( 'dim_1', 'dim_2', 'dim_3' ); $arr = Array(); while ( $row = mysql_fetch_obj($res) ) { foreach ( $fields AS $fieldName ) { $arr[$fieldName][] = $row->$fieldName; } } Link to comment Share on other sites More sharing options...
Delfins Posted August 24, 2005 Report Share Posted August 24, 2005 stap citu, uzdod jautājumus/piemērus! pareizi, lai neveidotos šada tipa sarunas.. Link to comment Share on other sites More sharing options...
swf Posted August 25, 2005 Author Report Share Posted August 25, 2005 Delfiins, ok, bet es būtu ļoti pateicīgs, ja tu man-muljkim taa iisi paskadrotu kaa tavaa piemeeraa izvadaas dati n o masiiva kaa es jautaaju: piem: Peeteris 54568784 88754635 54746485 54564554 nevis Peeteris 54568784 Peeteris 88754635 Peeteris 54746485 Peeteris 54564554 Ja piem man ir 3 personas ar daudziem numuriem, tad sanaak ka man buus vajadziigi 3 masiivi vai kaa? kaut kaa taa iznaak gala rezultaats? $Peteris = array(0 => 54568784, 1 => 54568784, 2 => 54568784, 3 => 54568784, ); Link to comment Share on other sites More sharing options...
bubu Posted August 25, 2005 Report Share Posted August 25, 2005 A es nekā nesaprotu. Link to comment Share on other sites More sharing options...
v3rb0 Posted August 25, 2005 Report Share Posted August 25, 2005 Ja piem man ir 3 personas ar daudziem numuriem, tad sanaak ka man buus vajadziigi 3 masiivi vai kaa?$Peteris = array(0 => 54568784, 1 => 54568784, 2 => 54568784, 3 => 54568784, ); 21457[/snapback] $arr = array('Peteris' => array(54568784, 54568784, 54568784, 54568784), 'Peteris2' => array(54568784, 54568784, 54568784, 54568784)); Link to comment Share on other sites More sharing options...
swf Posted August 25, 2005 Author Report Share Posted August 25, 2005 $fields = Array( 'dim_1', 'dim_2', 'dim_3' ); Shajaa gmasiivaa tiek ieivetoti lauku nosaukumi vai vienkaarshi manis nodevineeti mainiigie? es ar neko nesaprotu :/ Link to comment Share on other sites More sharing options...
Delfins Posted August 25, 2005 Report Share Posted August 25, 2005 Bļe, `domā līdzi` (reklāmu esi redzējis?) galu galā ir funkcija print_r() attiecīgi cikls būs: foreach( $arr AS $dimName => $dimData ) { print "<p>{$dimName}</p>"; foreach( $dimData AS $data ) { print "<p>{$data}</p>"; } } Link to comment Share on other sites More sharing options...
Delfins Posted August 25, 2005 Report Share Posted August 25, 2005 (edited) Shajaa gmasiivaa tiek ieivetoti lauku nosaukumi vai vienkaarshi manis nodevineeti mainiigie? es ar neko nesaprotu :/ 21460[/snapback] da ti če, traumēts kaut kāds? skaidri un gaiši pateikts/nosuakts Array mainīgais $fields = Array(...) tev vēl nepielec, kas tur varētu būt? :) Edited August 25, 2005 by Delfins Link to comment Share on other sites More sharing options...
swf Posted August 25, 2005 Author Report Share Posted August 25, 2005 Nu vo bļe, liels paldies bļe, to man arii vajadzeeja Delfiin bļe. God bless ya. ps. labaak saki 'bitīt matos' , nevis kaut kaadu slaaviski BĻE Link to comment Share on other sites More sharing options...
Recommended Posts