thesnarkie Posted October 2, 2009 Report Share Posted October 2, 2009 (edited) $code_result = mysql_query("SELECT `code` FROM `item` WHERE `category_id`='185'",$db); $result_b = mysql_fetch_array($code_result); if(in_array($searchstring,$result_b)) { $searchstring = 0; } Ko es nepareizi izdarīju, ka man print_r($result_b); arrajā parādās tikai kverija pirmais row? Edited October 2, 2009 by thesnarkie Quote Link to comment Share on other sites More sharing options...
marcis Posted October 2, 2009 Report Share Posted October 2, 2009 Tu aizmirsi par to, ka vajadzīgs jāciklē caur ierakstiem.. Bet vispār jau pamatos pieeja nav pareiza. Tev nav jāvelk no datubāzes ārā visi ieraksti un php pusē jāsalīdzina, to var izdarīt mysql pusē. SELECT COUNT(*) FROM `item` WHERE `category_id`='185' AND `lauks`='$searchstring' Quote Link to comment Share on other sites More sharing options...
thesnarkie Posted October 2, 2009 Author Report Share Posted October 2, 2009 (edited) Es jau labprāt to izdarītu mysql pusē, bet viss ir nedaudz sarežģītāk tāpēc to vieglāk ir php pusē. Ok, paldies! Edited October 2, 2009 by thesnarkie Quote Link to comment Share on other sites More sharing options...
ohmygod Posted October 2, 2009 Report Share Posted October 2, 2009 Pilnīgi noteikti pieslienos marcis - to vajag un arī VAR darīt mysql pusē. Ko tu darīsi pie ļooti daudz ierakstiem, arī karināsi serveri pieprasot db nenormāli daudz liekus datus un tos tad mēģinot pēc tam dzīt ciklā iekš php. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.