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 8425893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:24:00+00:00 2026-06-10T04:24:00+00:00

This while loop is not performing any of the echo’s. I’ve tested mysql_num_fields($result); and

  • 0

This while loop is not performing any of the echo’s. I’ve tested mysql_num_fields($result); and it gives me 16 so it’s not that $i is already greater than $j. It’s not going infinite on me either, just doing nothing.

while ($row = mysql_fetch_array($result))  
{ 
    $i = 1;
    $j = mysql_num_fields($result);

    if ($i <= $j) {
        echo "<li>";
        echo "<a id='autoload' href='images/big/".$row['card$i'].".jpg' class='highslide'      onclick='return hs.expand(this, config1 )'>";
        echo "<img src='images/small/".$row['card$i']."jpg' alt''";
        echo " title='";
        echo $year." ". $brand." ".$playerfirst." ".$playerlast." ".$details."'/>";
        echo "</a>";
        echo "</li>";
        $i++;
    }
    else {
        break;
    }
}

I guess I should have said that this query only returns 1 row. I then need to pull a number from several different columns (card1, card2, card3…card16) and put it in as the image file name as you see above. Also I understand all of the mysqli and protection from injection stuff I just don’t really need to worry about it with this sort of project.

  • 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-06-10T04:24:02+00:00Added an answer on June 10, 2026 at 4:24 am

    FROM PHP MANUAL

    Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. The type of returned array depends on how result_type is defined. By using MYSQL_BOTH (default), you’ll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).

    If two or more columns of the result have the same field names, the last column will take precedence. To access the other column(s) of the same name, you must use the numeric index of the column or make an alias for the column. For aliased columns, you cannot access the contents with the original column name.

    your while will run only for each result. You should only need to do

    while ($row = mysql_fetch_array($result))  
    { 
    
        echo "<li>";
        echo "<a id='autoload' href='images/big/".$row['card'].".jpg' class='highslide'      onclick='return hs.expand(this, config1 )'>";
        echo "<img src='images/small/".$row['card']."jpg' alt''";
        echo " title='";
        echo $year." ". $brand." ".$playerfirst." ".$playerlast." ".$details."'/>";
        echo "</a>";
        echo "</li>";
        
    
    }
    

    Doing this will cycle only through each result. While there is a row from the result, do this. Return to the top then do again if there is still a row availabe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've been stuck on this do-while loop not working for about two hours.
I'm performing a while loop in C#, this is going through some records being
I'm performing a nested loop in python that is included below. This serves as
I have a while loop from a query called $result . Inside this while
This while loop does not properly store the values needed into the rectangle array.
I have the following loop: while($row = mysql_fetch_assoc($result)) { <some code> if ($user) echo
I have a function creating entries via grid() like this: (replace while-loop with function,
I am trying update text views while this loop is processing. Here is my
This is a working snippet of a while loop : while(total_bytes_read != fsize){ while((nread
I've run into this while writing a Traveling Salesman program. For an inner loop,

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.