|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-06-25 17:04 UTC] sniper@php.net
[2002-06-25 18:02 UTC] a dot nichau at digitale-zeiten dot de
[2002-06-25 18:11 UTC] sniper@php.net
[2002-06-25 18:12 UTC] sniper@php.net
[2002-06-25 19:50 UTC] rasmus@php.net
[2002-06-26 04:21 UTC] a dot nichau at digitale-zeiten dot de
[2002-06-26 18:31 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
I tried several methods to read out the three newest articles in our cms separated from other news tables. In short I query the first news table list the output and query the next table. <? $sql="SELECT CONCAT(b.title,' ',b.link) as titel,b.id,DATE_FORMAT(b.Creation_Date,'d.m.Y') as datum FROM news AS b,members AS a WHERE a.id='$id' AND b.Author_Name=CONCAT(a.vorname,' ',a.name) ORDER BY Modify_Stamp DESC LIMIT 3"; $rs=mysql_query($sql) or die(mysql_error()); while(list($titel,$id,$datum) = mysql_fetch_array($rs)){?> <?=$datum?>, <a href="/magazin/<? echo $id?>/" target="_blank"><?=$titel?></a><br/> <? } ?> <hr noshade size="1"/> <? mysql_free_result($rs); mysql_close(); include(CONNECT); $sql="SELECT b.title as titel,b.id,DATE_FORMAT(b.Creation_Date,'d.m.Y') as datum FROM news_box AS b,members AS a WHERE a.id='$id' AND b.Author_Name=CONCAT(a.vorname,' ',a.name) ORDER BY Modify_Stamp DESC LIMIT 3"; $rs2=mysql_query($sql) or die(mysql_error()); while($myrow = mysql_fetch_array($rs2)){?> <?=$myrow[datum]?>, <a href="/journal/<? echo $myrow[id]?>/" target="_blank"><?=$myrow[titel]?></a><br/> <? } mysql_close(); } ?> The Bug is that the second loop isn?t started due to the loop-trigger already set to false. Even renaming variables and using different db connections didn?t solve the problem. Queries are ok and separated from another they bring the right resultset. Hope this was clear enough for you.