Digital-X Posted March 19, 2004 Report Share Posted March 19, 2004 Virsraxtaa ir mans jautaajums :P Nu taatad kaads zin? Link to comment Share on other sites More sharing options...
Robis Posted March 19, 2004 Report Share Posted March 19, 2004 Uztaisa mainiigo $querycount = 0; , kursh tiek palielinats $querycount++ katru reizi, kad tiek izpildiits kaads query, beigaas echo $querycount. Piemeeram, apmeeram shaadu funkciju var ievietot: function query($query) { $result = mysql_query($query); if ($result) { $querycount++; return $result; } else { return FALSE; } } Link to comment Share on other sites More sharing options...
Digital-X Posted March 20, 2004 Author Report Share Posted March 20, 2004 (edited) Tad lapas augshaa jaaliek query(); un apakshaa skripts? un veel, kas ir mainiigasi $query? //man ar PHP datubaazeem ne iipashi labi iet... Edited March 20, 2004 by Digital-X Link to comment Share on other sites More sharing options...
hu_ha Posted March 20, 2004 Report Share Posted March 20, 2004 nu vispirms jau par Robis ieteikto funkciju - taa nestraadaas kaa tas bij domaats, proti, $querycount mainiigais ir funkcijas iekshienee un funkcija sho mainiigo nedz nodod nedz arii sanjem (ja nu vieniigi kaa globaalo, kas nav kruta) to Digital-X: saakumaa noliec mainiigo $querycount=0; pie katra vaicaajuma palielini $querycount par viens, t.i., $querycount++; varbuut, ka ir kaada php iebuuveetaa funkcija, kas to nosaka, bet taa kaa nav shaada lieta bijusi nepiecieshama, tad nezinaashu (uzmetot aci php.net neatradu). Link to comment Share on other sites More sharing options...
Digital-X Posted March 20, 2004 Author Report Share Posted March 20, 2004 t.i. $querycount=0; $DB->query("SELECT * FROM ibf_admin_sessions WHERE ID='".$IN['adsess']."'"); $querycount++; $DB->query("SELECT * FROM ibf_members WHERE id='".$row['MEMBER_ID']."'"); $MEMBER = $DB->fetch_row(); $querycount++; $DB->query("SELECT * FROM ibf_groups WHERE g_id='".$MEMBER['mgroup']."'"); $GROUP = $DB->fetch_row(); $querycount++; echo $querycount; Shaadi? Tie queriji ir no IPB(par piemeeru) Link to comment Share on other sites More sharing options...
hu_ha Posted March 20, 2004 Report Share Posted March 20, 2004 nu taa vismaz es dariitu... ja jau tu darbojies ar objektiem, tad vari, protams, to mainiigo piesaistiit klasei etc. class A { var ... var $querycount=0; .... function countQuery() { $this->querycount+=1; return ($this->querycount); } } un attieciigi: $a = new A(); $DB->query("SELECT * FROM ibf_admin_sessions WHERE ID='".$IN['adsess']."'"); $a->countQuery(); $DB->query("SELECT * FROM ibf_members WHERE id='".$row['MEMBER_ID']."'"); $MEMBER = $DB->fetch_row(); echo $a->countQuery(); nu kaut kaa taa :) Link to comment Share on other sites More sharing options...
Digital-X Posted March 20, 2004 Author Report Share Posted March 20, 2004 Ok, liels paldies! :) Link to comment Share on other sites More sharing options...
Robis Posted March 20, 2004 Report Share Posted March 20, 2004 hu_ha, nu tu man pilniigi iznjeemi vaardus no mutes!!! Ideja jau maneejaa bija skaidra, vai ne??? Var jau uztaisiit arii shaadi (piemeers): $DaTaBaSe->query("SELECT * FROM `table` ORDER BY `id`;"); Class DaTaBaSe() { $querycount = 0; function query($query) { $result = mysql_query($query); if ($result) { query_count(); return $result; } else { return FALSE; } } function query_count() { $this->querycount++; return $this->querycount; } } echo $DaTaBaSe->query_count; Atsevishkjaas daljas, ja cilveeks grib zinaat, kur jaaliek varu jau pateikt! Pirmkaart jau objekts DaTaBaSe ir nepilniigs, jo nepiecieshams veel piekonekteeties datubaazei utt. Link to comment Share on other sites More sharing options...
Recommended Posts