So, how about this? $resultb = mysql_query("SELECT id,title,mid,lastedit,hit,reply,`lock` FROM bt_message where ch='$ch' ORDER BY top,lastedit DESC LIMIT $limit,30",$db); while ($result = mysql_fetch_array($resultb)) { $result2b = mysql_query("SELECT nick FROM bt_member where id ='$result[mid]'",$db); $result2 = mysql_fetch_array($result2b); mysql_free_result($result2b); .......... }
-- "James Lobley" <[EMAIL PROTECTED]> ???????:[EMAIL PROTECTED] > I'd guess at: > > $resultb = mysql_query("SELECT bt_member.nick FROM bt_member, bt_message > WHERE bt_member.id=bt_message.mid AND bt_message.ch='$ch'", $db); > $result2 = mysql_fetch_array($resultb); > ......... > > > -----Original Message----- > From: Erick [mailto:[EMAIL PROTECTED] > Sent: 04 June 2003 13:12 > To: [EMAIL PROTECTED] > Subject: [PHP] How to optimize this MySQL command? > > > $resultb = mysql_query("SELECT id,mid FROM bt_message where ch='$ch' ",$db); > while ($result = mysql_fetch_array($resultb)) { > $result2b = mysql_query("SELECT nick FROM bt_member where id ='$result[mid]' > ",$db); > $result2 = mysql_fetch_array($result2b); > ......... > } > > Can combine together? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > This email is only intended for the person(s) to whom it is addressed and > may contain confidential information. Unless stated to the contrary, any > opinions or comments are personal to the writer and do not represent the > official view of the company. If you have received this e-mail in error, > please notify us immediately by reply e-mail and then delete this message > from your system. Please do not copy it or use if for any purposes, or > disclose its contents to any other person. > > We make every effort to keep our network free from viruses. You should > independently check this e-mail and any attachments for viruses, as we > can take no responsibility for any computer viruses that might be > transferred by way of this e-mail. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php