RaaapuLis Posted December 30, 2009 Report Share Posted December 30, 2009 (edited) Tātad ir vairāki variabļi $1 = $_POST['1']; $2 = $_POST['2']; $3 = $_POST['3']; ($1 != $2 && $1 != $3 && $2 != $3) => iznākumam šādam vaidzētu būt.. kā lai salīdzina visus trīs savā starpā, un kā lai izdara tā lai viņi nedrīkstētu būt vienādi.. p.s. to variabļu ir daudz vairāk kā 3.. Edited December 30, 2009 by RaaapuLis Link to comment Share on other sites More sharing options...
vincister Posted December 30, 2009 Report Share Posted December 30, 2009 Ja tiešām gribi salīdzināt katru ar katru. PHP $ln= count($_POST); for($i=0;$i<$ln;$i++){ for($j=0;$j<$ln;$j++){ if($_POST[$i]==$_POST[$j]) echo "Error"; } } Link to comment Share on other sites More sharing options...
RaaapuLis Posted December 30, 2009 Author Report Share Posted December 30, 2009 Paldies Link to comment Share on other sites More sharing options...
RaaapuLis Posted December 30, 2009 Author Report Share Posted December 30, 2009 (edited) Atvainojso par Doublepost, bet lai entaisоtu jaunu tзmu, next jautвjums.. Saistоts ar MySql Tabulв ir daudz vвєdi, u nkв iespзjams izvilkt tiak ivienu, to kas ir atkвrtojies visvairвk reiюu.. Piem. tabulaa topuser ir ieraksti => admin, user, root, user, demo, demo, admin, demo root = 1 admin = 2 user = 2 demo =3 vajadzeetu izviltk tikai demo un vienu reizi Edited December 30, 2009 by RaaapuLis Link to comment Share on other sites More sharing options...
X ID Posted December 30, 2009 Report Share Posted December 30, 2009 (edited) EDIT ALL. SELECT column, COUNT(*) AS times_repeat FROM `table` GROUP BY column ORDER BY times_repeat DESC LIMIT 1 Un vēl viens risinājums par masīvu salīdzināšanu: PHP <? foreach($_POST as $key=>$value){ $check = array_search($value, $_POST); if( $check !== false && $check != $key) die('atkārtojās'); } ?> Edited December 30, 2009 by X ID Link to comment Share on other sites More sharing options...
RaaapuLis Posted December 30, 2009 Author Report Share Posted December 30, 2009 (edited) Vot, tgd abi straadaa tnx ;] EDIT: ci knoprotu viņšprecīzi saskaita, bet ne vis iraksta vienādi, piem viens uzraksta raapulid, otrs rapulis, treishais RaaapuLis, tas nekas, vins njem kaa LIKE? Edited December 30, 2009 by RaaapuLis Link to comment Share on other sites More sharing options...
w4p1337 Posted December 30, 2009 Report Share Posted December 30, 2009 1. Distinct , lai vienu no visiem vienādiem izvilktu.. 2. LIKE ņems ja arī pierakstīsi lai ņem kā Like un rāpulis raapulis un raaapulid ir 3 dažādi vārdi un ar rapulis nedabūsi visus ārā Link to comment Share on other sites More sharing options...
X ID Posted December 30, 2009 Report Share Posted December 30, 2009 Man ir aizdoma, ka tev vispār pēc kaut kādiem id jāgrupē.. Un drošvien vispār nav jāgrupē, bet jānokešo. Link to comment Share on other sites More sharing options...
RaaapuLis Posted December 30, 2009 Author Report Share Posted December 30, 2009 (edited) nē, nav nekas jāgrupē, vnk pasaki tajā kvērijāvar iebāzt LIKE kkā ;D pati doma, jau pateicoties tev sanāca.. EDIT: man tabulās nav id XD vn kuzreiz pa taisn ovajadzīgā informācija u nviss, jo nav tik svarīgi sīkumi tur Edited December 30, 2009 by RaaapuLis Link to comment Share on other sites More sharing options...
w4p1337 Posted December 31, 2009 Report Share Posted December 31, 2009 Bljin .. Ja es tomer uzkjeeru domu, tad jeb** .. Kapec nafig tu tadas samazgas taisi? Nevar vienkarshak katram adminam,rootam,raapulim un niikulim pieskjirt grupas id un tad izvadiit, cik no katras ir lietotaaju? Nevis shaadas samazgas rakstiit Link to comment Share on other sites More sharing options...
RaaapuLis Posted December 31, 2009 Author Report Share Posted December 31, 2009 Nē, tu nesaprati domu Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now