Thanks for the reply I have tried assigning the var via $query1 , but because I have the nested query inside the other one then I get the result 10 times over , As has been suggested I guess the best option would be a table join but I am not up with the play on joins , ie left join etc so I am a little stuck.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marek Kuziel Sent: Monday, October 30, 2006 4:37 PM To: [email protected] Subject: Re: Anybody up with php Hey Jason, you're re-assigning $query variable with your second db query. You need to do the same thing as you did with the $info variable, so assign second query into something like $query1 So, your code will look like: ... $query1 = $DB->query("SELECT subject, lastposter, views, replies, lastpost FROM thread ORDER BY lastpost DESC LIMIT 10"); while ($info1 = $DB->fetch_row($query1)){ ... Don't hesitate to ask if you need further explanation... Cheers, Marek On 10/30/06, 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. -- Marek Kuziel | http://kuziel.info ([EMAIL PROTECTED]) Encode - Intelligent Web Solutions | http://encode.net.nz ([EMAIL PROTECTED]) phone: + 64 21 1727255 | icq: 139312685 | skype: vshivak __________ NOD32 1.1842 (20061027) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com
