Database Articles

  Home arrow Database Articles arrow Alternating row colors with PHP and my...
DATABASE ARTICLES

Alternating row colors with PHP and mySQL
By: Matt Wade
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 7
    2002-03-02

    Table of Contents:
  • Alternating row colors with PHP and mySQL
  • Let's Do It

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Alternating row colors with PHP and mySQL


    (Page 1 of 2 )

    A quick tutorial explaining how to alternate table row colors using PHP and mySQL.

    Why am I writing this? Well, frankly I am tired of answering the same question over and over and would like a place to just point people for an answer. Besides that, I am guessing that there are other people who can benefit from this that just aren't asking the question.

    The examples in this tutorial are using PHP and mySQL. But, the theory can easily be applied to any other programming language or database system. Just use your noodle (that's your brain) and I am sure you can figure it out.

    Ok, the first thing we are going to do is get our data from our database. I'm not going to go into alot of detail here. I will just show you the code. Next we will display the data. It's as simple as that.

    The whole key to displaying the data in the way we want is the modulus operator (%). What does the modulas operator do you ask? It simply gives us the remainder of a division. So, 3 % 2 returns 1, 3 % 3 returns 0. Easy huh? Ok, on with the code to do this.

    More Database Articles Articles
    More By Matt Wade

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap