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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:05:09+00:00 2026-06-13T14:05:09+00:00

Well, I’ve been screwing around with this for about 6 hours and I just

  • 0

Well, I’ve been screwing around with this for about 6 hours and I just can’t get it to work right. I’m sure it’s just something stupid i’m doing, maybe your guys’ fresh eyes can point it out.

$i = 0;
$sql = mysql_query("SELECT type, info, url FROM alerts WHERE username = '$user_logged_in' ORDER BY id ASC LIMIT 40");
$div_grid = '<div style="float:left;">';


while ($row = mysql_fetch_array($sql))
{
    if ($i < 11){
    $display = '<a href="' . $row['info'] . '"><div class="' . $row['type'] . "_alert" . '" style="float:left; margin-left:-22px;"></div></a>';


    $div_grid .='<div style="float:left;">' . $display . '</div>';
    $i++;
    } 
    if ($i > 11){
        $display = '<a href="' . $row['info'] . '"><div class="' . $row['type'] . "_alert" . '" style="float:left; margin-left:-22px; margin-top:14px;"></div></a>';


    $div_grid .='<div style="float:left;">' . $display . '</div>';
    $i++;
    }

}
$div_grid .= '</div>';

echo $div_grid;

For some reason, I get the whole first line of these div outputs, but the second line isn’t coming out. Except if I set the $i >= 11{ which then gives me TWO id 11s. Obviously i’m missing something crucial here. Any ideas?

Also, in the end, i’d like to make the if statements to be >= 10 && <= 20; which hasn’t seemed to be working so far but I’m guessing there’s an issue somewhere else first.

  • 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-13T14:05:10+00:00Added an answer on June 13, 2026 at 2:05 pm

    You are incrementing $i++ twice. It is also necessary to use >= since you will otherwise be missing row 11, and the loop will run with no output ($1==11, so it’s not less than or greater than 11) until the end of your recordset.

    while ($row = mysql_fetch_array($sql)) {
        if ($i < 11){
            // first row
        } else {
            // second row
        }
        $i++; //increment
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well I have been thinking about this for a while, ever since I was
Well I've did do my research and I just can't seem to figure this
Well there is enough information about this subject. For example this thread was very
Well my short and easy to explain explanation can be this. I have 2
Well, not sure I am going to be able to write this out to
Well im new to javascript but why does this not work, all i want
Well I read this article, however the scope bar just shows instantly, no animation.
Well, my website can not redirect to https://www.facebook.com/QuaFootSpa from http://quafootspa.com/ I have tried redirection
Well I can start the thread when I press togglebutton to ON and it
well i have a configuration like this in the components part of my config

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.