Wuu Posted July 10, 2014 Report Share Posted July 10, 2014 $result[] = mysqli_query($link,'select t1.tid,t1.title,t1.start_date,t1.starter_name,t2.post,t1.starter_id,"bignews" as array_name from '.$INFO['sql_tbl_prefix'].'topics t1 join '.$INFO['sql_tbl_prefix'].'posts t2 on (t1.tid = t2.topic_id) where t1.forum_id = 2 order by t1.start_date desc limit 1;'); $result[] = mysqli_query($link,'select t1.tid,t1.title,t1.start_date,t1.starter_name,t2.post,t1.starter_id,"news" as array_name from '.$INFO['sql_tbl_prefix'].'topics t1 join '.$INFO['sql_tbl_prefix'].'posts t2 on (t1.tid = t2.topic_id) where t1.forum_id = 44 order by t1.start_date desc limit 6;'); //echo mysqli_error($link); foreach ($result as $result) { $x = 0; while ($r = mysqli_fetch_array($result, MYSQL_ASSOC)) { $x++; foreach ($r as $key => $value) { $r[$r['array_name'].$x.$key] = $r[$key]; unset($r[$key]); } $msg = array_merge($msg,$r); } } Kāds būtu ātrākais veids ielādēt Mysql query php arry'ā? Pagaidām man sanācis uzkricelēt ko tādu. Ideja ir tādā, ka PHP izveido array ar unikāliem key'iem kurus vēlāk var ar str_replace samainīt teksta templaitā ar attiecīgajiem rezultātiem. Un iekašot, lai lietotājs ielādē pliku html. tb {bignews1title} uz "Kaut kāds rezultāts" Quote Link to comment Share on other sites More sharing options...
jurchiks Posted July 10, 2014 Report Share Posted July 10, 2014 FROM '.$INFO['sql_tbl_prefix'].'topics Really? Kas notika ar 'USE ' . $INFO['sql_tbl_prefix']; ? foreach ($result as $result) Nemani kaut ko neriktīgu? mysqli_fetch_array($result, MYSQL_ASSOC) -> mysqli_fetch_assoc($rset) Bet vispār, templeitā vajadzētu būt ciklam, kurš loopo cauri tavam masīvam un izvada vienkārši tid/title/start_date, nevis kaut kādu šitādu sviestu. Lieki sarežgī dzīvi. Samerdžo abus resultsetus un izvadi ciklā, nevajag taisīt nekādu šurumburumu ar atslēgām. Quote Link to comment Share on other sites More sharing options...
Wuu Posted July 10, 2014 Author Report Share Posted July 10, 2014 (edited) Neverminde, taisiet ciet. Ar šo negatīvo attieksmi pie laba rezultātā tāpat nenonāksi. Tulītās saskries vēl indivīdi, mērīties ar krāniem. Paldies, iztikšu. Edited July 10, 2014 by Wuu Quote Link to comment Share on other sites More sharing options...
jurchiks Posted July 10, 2014 Report Share Posted July 10, 2014 (edited) Giving up so soon? P.S. cik zinu, autoram ir tiesības pašam slēgt topiku. Edited July 10, 2014 by jurchiks Quote Link to comment Share on other sites More sharing options...
rpr Posted July 11, 2014 Report Share Posted July 11, 2014 Topikus slēgt vispār nevajadzētu. Foruma jēga jau vsipār ir diskusijā nevis dabūju risinājumu un aizslēdzu, izdzēšu un vēl sadrišu ierakstus, lai tik citi nesaprastu manis rakstīto. 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.