Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1016657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:34:52+00:00 2026-05-16T10:34:52+00:00

CODE1: while( $row1 = mysql_fetch_array($result2) && $row2 = mysql_fetch_array($result4) ) { $details[0] = $row1[0];

  • 0

CODE1:

while( $row1 = mysql_fetch_array($result2) && $row2 = mysql_fetch_array($result4) )
{
 $details[0] = $row1[0];
 $details[1] = $row2[0];
 var_dump($details[0]);
 var_dump($details[1]);
}

OUTPUT1:

NULL string(1) "5" 

CODE2:

while($row1 = mysql_fetch_array($result2))
{
 $details[0] = $row1[0];
 var_dump($details[0]);
}
while($row2 = mysql_fetch_array($result4))
{
 $details[1] = $row2[0];
 var_dump($details[1]);
}

OUTPUT2:

string(6) "728548" string(1) "5"

**OUTPUT2** is the desired result. I have checked the rest portion of my code that I haven’t mentioned here, nothing is wrong with that. Using **CODE1** instead of **CODE2** gives wrong result. I tried **CODE1** just for reducing the length of my code but it isn’t working. Why can’t we use more than one mysql_fetch_array() like I did in **CODE1** ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:34:53+00:00Added an answer on May 16, 2026 at 10:34 am

    The operator precedence of && is higher than =. So, put parenthesis around the two parts and try this:

    while(($row1 = mysql_fetch_array($result2)) && ($row2 = mysql_fetch_array($result4)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: while ($content = mysql_fetch_array($content2)){ echo $content[0]; session_start(); $_SESSION['content'] =
I've got a piece of code: while(1) { if(recvfrom(*val, buffer, 1024, MSG_PEEK, NULL, NULL)==-1)
i want to count total number of rows, sample : row1 = 1 row2
The Code - while($row=mysql_fetch_array($result)) { <div class=feed_element> <span class=feed_title> <?php echo $row['user_id'];?> </span> <span
I just saw this code while studying the wordpress source code (PHP), You can
Consider the following code: while(true) { someFunction(); Thread.sleep(1000); } What I want is that,
I'm having trouble with some Regex code while scraping YouTube playlist pages. It mostly
There is a problem executing this block of code while passing the parameter. Parameter
I often run into the situation where I want to disable some code while
I have a problem using JSON and arrays. Here is my code: while($row =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.