Wuu Posted September 2, 2009 Report Share Posted September 2, 2009 parastais sintex where forum_id != 2 && forum_id != 3 && forum_id != 4 Šitā kaut kā nevar? Vai tikai pa vienam rakstot var? where forum_id != 2,3,4 Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted September 2, 2009 Report Share Posted September 2, 2009 WHERE NOT(forum_id IN(2,3,4)) Quote Link to comment Share on other sites More sharing options...
kasisppr Posted September 2, 2009 Report Share Posted September 2, 2009 vai arī WHERE forum_id NOT IN(2,3,4) Quote Link to comment Share on other sites More sharing options...
Wuu Posted September 2, 2009 Author Report Share Posted September 2, 2009 (edited) Vedu sunī ārā un tieši iedomājos par iekavām :) Bet kāpēc nevar lietot != obligāti jālieto vārdi? Edited September 2, 2009 by Wuu Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted September 2, 2009 Report Share Posted September 2, 2009 nu, tāpēc, ka ir izdomājuši, ka != katrā pusē var būt tikai viena "lieta". :) vārdus var nelietot, taču šķiet pēc ANSI SQL ir jāraksta ar vārdiem. Quote Link to comment Share on other sites More sharing options...
Wuu Posted September 2, 2009 Author Report Share Posted September 2, 2009 $disable = ''; if (!empty($uSet['disabled_forums'])) { $disable = 'where t1.forum_id not in ('.$uSet['disabled_forums'].') '; } $result = mysql_query('select t1.tid,t1.title,t1.posts,t1.last_poster_name,t1.starter_name,t2.post from '.$INFO['sql_tbl_prefix'].'topics t1 join '.$INFO['sql_tbl_prefix'].'posts t2 on (t1.tid = t2.topic_id) '.$disable.'group by t1.tid order by t1.last_post desc, t2.post_date desc limit 10;'); if (!empty($result)) { $l = 0; while ($r = mysql_fetch_array($result)) { $u[++$l]['ntopic_id'] = $r[0]; $u[$l]['ntopic_title'] = $r[1]; $u[$l]['ntopic_posts'] = $r[2]; $u[$l]['ntopic_l_name'] = $r[3]; $u[$l]['ntopic_s_name'] = $r[4]; $u[$l]['ntopic_post'] = $r[5]; } } Vai nav kāda gatava funkcija kas izpildītu $u[++$l]['ntopic_id'] = $r[0]; $u[$l]['ntopic_title'] = $r[1]; $u[$l]['ntopic_posts'] = $r[2]; $u[$l]['ntopic_l_name'] = $r[3]; $u[$l]['ntopic_s_name'] = $r[4]; $u[$l]['ntopic_post'] = $r[5]; Nu es domāju savāktu visus myql datus vienā arajā, lai lietotu vēlāk? Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted September 2, 2009 Report Share Posted September 2, 2009 šitā: while(...){ ... $u[]=$r; ... } ? Quote Link to comment Share on other sites More sharing options...
Wuu Posted September 2, 2009 Author Report Share Posted September 2, 2009 Tu laikam nesaprati mani un es nesaprotu tevi lai nu paliek kā ir. Quote Link to comment Share on other sites More sharing options...
Aleksejs Posted September 2, 2009 Report Share Posted September 2, 2009 Iespējams... ;) Ja gribi, lai indeksi atbilst kolonnu nosaukumiem, tad izmanto: mysql_fetch_assoc vai mysql_fetch_array($result,MYSQL_ASSOC) ja gribi nolasīt visu rezultātu uzreiz bez while... tad gan nezinu. Jāpameklē. :) Quote Link to comment Share on other sites More sharing options...
Kemito Posted September 2, 2009 Report Share Posted September 2, 2009 Viglāk jau ir manšķiet pēc Alekseja teiktā, jo izmantot " != " nebūtu skaisti, padomā cik gari tu daūtu rakstīts! un cik tas kods izskatītos nesmuks. 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.