php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17981 list() unable to set back boolean trigger
Submitted: 2002-06-25 16:45 UTC Modified: 2002-06-26 18:31 UTC
From: a dot nichau at digitale-zeiten dot de Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 4.1.2 OS: Linux 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: a dot nichau at digitale-zeiten dot de
New email:
PHP Version: OS:

 

 [2002-06-25 16:45 UTC] a dot nichau at digitale-zeiten dot de
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-25 17:04 UTC] sniper@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.
 [2002-06-25 18:02 UTC] a dot nichau at digitale-zeiten dot de
Thanks for quick comment. But I insist on that being a bug. It?s definitely no logic fault traced back to me. I know what I`m doing also you don?t believe such an essential method to be buggy. Otherwise I had been able to get the result on a more complicated way, but I would have been able to, wouldn?t I?
 [2002-06-25 18:11 UTC] sniper@php.net
I propably misunderstood what you meant here..
Can you provide some short and simple example
without any mysql stuff?

--Jani

 [2002-06-25 18:12 UTC] sniper@php.net
..and without any HTML too.


 [2002-06-25 19:50 UTC] rasmus@php.net
I don't see a bug here either.  There are literally thousands of programs out there doing exactly this.  Give us a reproducable test case to work with here.  I bet the second query is simply not returning any rows.
 [2002-06-26 04:21 UTC] a dot nichau at digitale-zeiten dot de
That?s all there is to it. It?s indeed returning three rows according to the first query. Here a short schema for your understanding:

query1
loop through resultset1

query2
loop through resultset2

Both queries for themself return a valid three-rows having resultset. The only failure is, that loop2 isn?t executed. In my opinion it?s because the boolean value for the loop is already set to "false". But I cannot test  this because I?m running in a production area and no debugging area.

Best regards,

Alex.
 [2002-06-26 18:31 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



This most likely is not any bug but some misunderstanding.

Try cleaning up your code a bit and/or provide us a good
short and self-containing (without any mysql stuff) script
which clearly shows the bug.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 29 08:01:25 2020 UTC