SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2001
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a product database, and I also have two columns ('click-thru this week', 'click-thru last week') to compare the changes in ranking of the products.

    I was wondering if there's an easy way to rank the products according to their click-thrus and to compare this week's ranking to the previous week.

    Result in my mind

    Top 10 List
    --------------
    1. xxxx (up)
    2. yyyy (up)
    3. zzzz (down)
    4. aaaa (down)

    (up) Up from last week / (down) Down from last week
    ----------------

    I am out of idea. I really need some help on this one.

    Thanx in advance,

  2. #2
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not too sure if this is what you're looking for, but here's an idea...

    PHP Code:
    <?php

    //pull the two columns out of MySQL in the right order
    $sql mysql_query ("SELECT thisWeekClick, lastWeekClick, product FROM $table ORDER BY thisWeekClick LIMIT 0,10");

    while (
    $row mysql_fetch_array ($sql))
    {
        
    //get the columns as variables
        
    extract($row);
        
        if (
    $thisWeekClick $lasWeekClick)
        {
            
    $status "(down)";
        }

        else
        {
            
    $status "(up)";
        }
        
        
    //go throught each row and display product/status
        
    echo "$product $status<br />";
    }

    ?>

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2001
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks quite simple. However, what would happen if thisWeekClicks are significantly lower than lastWeekClick?

    If this's the case, then all products will receive "down" status.

    Do you think there's a way to compare by their ranks?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •