presso Posted October 23, 2006 Share Posted October 23, 2006 ok the following code works , well works for pulling the info , well at least i think it does. I know my code is a little whacky as has been pointed out 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.[code]$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>"; }}[/code] Quote Link to comment Share on other sites More sharing options...
btherl Posted October 23, 2006 Share Posted October 23, 2006 What output are you expecting and what are you seeing? ARe you expecting[code]Fred 1/1/01 Blah! Fred 2 2Fred 1/1/01 Glerp Fred 1 0John 2/2/02 Blah Fred 5 1John 2/2/02 Fnord John 7 1[/code]But instead you are getting the same user on threads that belong to another user? Judging by your code structure, you would be expecting results like the above. Quote Link to comment Share on other sites More sharing options...
presso Posted October 23, 2006 Author Share Posted October 23, 2006 yes what you are showing is what i am expecting however that does not seem to be the case. this is more like what i am getting.[code]Fred 1/1/01 thread4 Fred 2 2Fred 1/1/01 thread3 Fred 1 0Fred 1/1/01 thread2 Fred 5 1Fred 1/1/01 thread1 John 7 1[/code]The output of thread4 fred 2 2 ect, is fine and what i am expecting , however the first query is outputing the same data. If i swap the querys around the first one displays the output correct and the second one displays the last line of the result 10 times.Can you see what i mean. I find it fustrating. I have tried every combination of moving the curly brackets as i thought they were causing the problem , but it either makes no difference or i get no output at all. Quote Link to comment Share on other sites More sharing options...
presso Posted October 23, 2006 Author Share Posted October 23, 2006 any takers at resolving this fustrating issue ?? 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.