anonīms Posted February 25, 2008 Author Report Share Posted February 25, 2008 Ir iespējams divus select'us ielikt iekšs viena kverija? Link to comment Share on other sites More sharing options...
andrisp Posted February 25, 2008 Report Share Posted February 25, 2008 bubu tev jau atbildēja. Link to comment Share on other sites More sharing options...
Aleksejs Posted February 25, 2008 Report Share Posted February 25, 2008 Un es pat piemēru uzrakstīju. ;) Link to comment Share on other sites More sharing options...
anonīms Posted February 25, 2008 Author Report Share Posted February 25, 2008 Tas nu būtu :) $jaunakie_kom = mysql_query ("(SELECT id, j AS kid, niks, komentars, datums, 1 AS tips FROM komentari) UNION (SELECT id, video AS kid, niks, komentars, datums, 2 AS tips FROM video_komentari ORDER BY datums) ORDER by datums DESC LIMIT 5"); while($pedkom = mysql_fetch_array($jaunakie_kom)) { echo "<li>".ShortenText($pedkom['2'].", <a href='.../jaunums/$pedkom[0]'>".$pedkom['3'])."</a></li>"; } Bet vel viena lieta - Kā varētu izveidot, lai viņš arī nosaka uz kuru linku jāiet? Pagaidām sanāk tā, ka visi komentāri ies uz jaunums/id, bet vajag, lai video komentāriem būtu links uz video/id Link to comment Share on other sites More sharing options...
Aleksejs Posted February 25, 2008 Report Share Posted February 25, 2008 Lūk tieši tādēļ, es izdarīju super mini ekstra milzu pakalpojumu un iekļāvu mākslīgu lauku tips, kurš ir 1, ja tas ir komentārs un 2, ja tas ir video. 1 IF konstrukcija while ciklā un gatavs ;) Link to comment Share on other sites More sharing options...
anonīms Posted February 25, 2008 Author Report Share Posted February 25, 2008 (edited) Hm, īsti nav skaidrs kā būtu pareizi echo "<li>".ShortenText($pedkom['2'].", <a href='http://gaming.wc3.lv/"; if($pedkom[tips] == '1') { echo "jaunumi"; } else { echo "video"; } echo "/$pedkom[1]'>".$pedkom['3'])."</a></li>"; } Edited February 25, 2008 by anonīms Link to comment Share on other sites More sharing options...
p4F Posted February 26, 2008 Report Share Posted February 26, 2008 (edited) kas tieši nesanāk? varbūt vajadzējas nevis : $pedkom[tips] == '1' bet $pedkom[tā_id] == '1' // jo tev taču nav mysql_fetch_assoc ja es neko nejaucu :D Edited February 26, 2008 by p4F Link to comment Share on other sites More sharing options...
anonīms Posted February 26, 2008 Author Report Share Posted February 26, 2008 Man tāpat nepieliec, kas īsti ir jāievieto tā_id vietā. Link to comment Share on other sites More sharing options...
xPtv45z Posted February 26, 2008 Report Share Posted February 26, 2008 Vai tik grūti ir uzrakstīt print_r($pedkom);, lai saprastu, kur un kas ir pieejams? Link to comment Share on other sites More sharing options...
anonīms Posted February 26, 2008 Author Report Share Posted February 26, 2008 (edited) Tas nu būtu skaidrs, bet ir vēl kas. <li>".ShortenText($pedkom['2'].", <a href='#http://gaming.wc3.lv/"; echo "yoyo"; echo "/$pedkom[1]'>".$pedkom['3'])."</a></li> Tā ir tā rinda, kur parādas komentārs. Kādēļ viņš neatļauj echo "yoyo"; ? Tur arī ir tā problēma. (error_reporting nevaru izmantot). Tiklīdz izņemu šo echo "yoyo" un savienoju <a href> zem viena echo tā atkal viss iet. Viņš pat neatļauj šādu variantu: <li>".ShortenText($pedkom['2'].", <a href='#http://gaming.wc3.lv/"; echo "/$pedkom[1]'>".$pedkom['3'])."</a></li> Tas varētu būt dēļ shortentext funkcijas? Edited February 26, 2008 by anonīms Link to comment Share on other sites More sharing options...
anonīms Posted February 26, 2008 Author Report Share Posted February 26, 2008 Tagad viss iet! Liels paldies. Izveidoju tā: if($pedkom[tips] == 1) { $tips = 'jaunums'; } else { $tips = 'video'; } echo "<li>".ShortenText($pedkom['2'].", <a href='http://gaming.wc3.lv/".$tips."/$pedkom[1]'>".$pedkom['3'])."</a></li>" Link to comment Share on other sites More sharing options...
Recommended Posts