Calling two sql statements at once

Posted on 2007-07-25
Last Modified: 2008-03-06
Is there a way to call two sql statements in one calling?  For instance I have this:

while($row = mysql_fetch_array($sql_comment))

Am I able to do something like:

while($row= mysql_fetch_array($sql_comment && $sql_replies))  ??
Question by:pingeyeg
    LVL 33

    Accepted Solution

    No. You need to call them separately and loop them separately.

    while (...) {
        while (...) {

    LVL 1

    Author Comment

    Darn, because I have two bits of code that are not working the way I want them to.  I am trying to display the subject of a group of question/answers and then when a new subject gets inserted a new set of question/answers starts.  Right now the subject does right, but the a/q are staying in the same place.  To see a working copy of what I mean go to  You will see two subjects, but the first reply that says "I did not see what you were looking at. Could you be more specific?" should be under the second subject at the bottom.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now