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

  • Home
  • SEARCH
  • 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 960411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:10:45+00:00 2026-05-16T01:10:45+00:00

How to change background color for last render row in while loop …. that

  • 0

How to change background color for last render row in while loop ….

that is

row1
row2
**row3**

If row4 is added then it should

row1
row2
row3
**row4**

that is star represents some bgcolor red…

this loop am following,,,,
$i = 1;
while ($row = mysql_fetch_assoc($sql)) {

$out_data[] = "<p>$i {$row['news']} </p>";

$i++;
}

$divider = '<div class="border"></div>';
$output = implode ($divider, $out_data);

echo $output;
  • 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-16T01:10:45+00:00Added an answer on May 16, 2026 at 1:10 am

    you can use mysql_num_rows to get the number of rows you have before the while loop.

     $row_count = mysql_num_rows($sql)
    

    inside the while loop

     if ($i==$row_count)
        // put color $out_data[] = "<p style="colorsomething">$i {$row['news']} </p>";
     else
        // dont put color $out_data[] = "<p>$i {$row['news']} </p>";
    

    does this help?

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

Sidebar

Ask A Question

Stats

  • Questions 493k
  • Answers 494k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Derby and Hypersonic SQL can both be run in memory… May 16, 2026 at 10:54 am
  • Editorial Team
    Editorial Team added an answer The precedence is fine. % is evaluated first, then ==,… May 16, 2026 at 10:54 am
  • Editorial Team
    Editorial Team added an answer You have to import flash.ui.Mouse, and use the fully qualified… May 16, 2026 at 10:54 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to get the iPhone background Color to change color every X
I've been using the following CSS3 option to change the highlight color of text
This is just an add on to my last question . Once I deselect
I have iframe that works at the server side : <iframe frameborder=0 runat=server style=width:
I want to create a jQuery dialogue and overwrite the color setting for this
I have a DIV with a link and a SPAN. When clicking the link,
I am trying to design a file hosting website template, the problem is i
I'm writing a firefox extension which displays a statusbarpanel containing some text. I want
I'm trying to apply a class to a link only if the current page
First up, JavaScript is definitely not my native tongue. Nevertheless, I've been tasked with

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.