Try browsing the data ans see if the first 10 entried ordered by regdate are
the same??? If so, then
$query = $DB->query("SELECT DISTINCT name, date, regdate FROM users ORDER BY
regdate DESC LIMIT 10");
Even so, I'm not too sure what you want to display, seeing as there is
absolutely no connection between the two queries. If there's supposed to be,
then you may want to JOIN the tables first.
hth,
Steve
On Mon, 30 Oct 2006 15:51:23 +1300
Jason <[EMAIL PROTECTED]> 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.
>
>