Looks like you have 2 loops, one nested inside the other.  It appears to
be doing what you have told it.

However you may want to look at using one query ( or at least
restricting the second query with a variable from the first.

Dave.


On Mon, 2006-10-30 at 15:51 +1300, Jason wrote:
> ok the following code works , well works for pulling the info , I know
> my code is a little whacky but it comes from within another module
> hence the layout. Anyway the second query's output works perfect and
> displays as it should but the first query just seems to display the
> same values for all 10 lines. Is it the way that i have the querys ect
> set out. Some helpful advice on this would be so welcome as its
> fustrating the hell out of me. 
> $query = $DB->query("SELECT name, date, regdate FROM users ORDER BY
> regdate DESC LIMIT 10"); 
> while ($info = $DB->fetch_row($query)){ 
> $name1 = $info['name']; 
> $date1 = $info['date']; 
> 
> $query = $DB->query("SELECT subject, lastposter, views, replies,
> lastpost FROM thread ORDER BY lastpost DESC LIMIT 10"); 
> while ($info1 = $DB->fetch_row($query)){ 
> $ctoff = "35"; 
> $subject = info1['subject']; 
> $lastposter = info1['lastposter']; 
> $views = info1['views']; 
> $replies = info1['replies']; 
> if (strlen($subject) > $ctoff) { 
> $subject = substr($subject,0,$ctoff); 
> $subject .= "..."; 
> } 
> 
> $content .= " 
> <tr> 
> <td class=\"sidedash\" align=\"left\" >$name1</td> 
> <td class=\"sidedash\" align=\"right\" >$date1</td> 
> <td class=\"sidedash\" align=\"left\" >$subject</td> 
> <td class=\"sidedash\" align=\"left\" >$lastposter</td> 
> <td class=\"sidedash\" align=\"right\" >$views</td> 
> <td class=\"sidedash\" align=\"right\" >$replies</td> 
> </tr>"; 
> } 
> } 
> 
> this is what i am getting with the results 
> 
> Query one | Query two 
> --------------------------------- 
> Fred 1/1/01 | thread4 Fred 2 2 
> Fred 1/1/01 | thread3 Fred 1 0 
> Fred 1/1/01 | thread2 Fred 5 1 
> Fred 1/1/01 | thread1 John 7 1 
> 
> 
> see how the result of the second query is outputing fine but the first
> query is just giving me the same result over and over 
> 
> It seems that the second query has precedent over the first one , i am
> sure its my layout of the code , I have tried about every different
> layout of the cury brackets but no luck.
> 
> 

Reply via email to