Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Atlanta, Jawja
    Posts
    3,066

    PHP/MySQL tweak needed, please...

    First off, if you're new to PHP/MySQL programming, don't apply, please. This job pays $10-$15, depending on quality of work. It should be a VERY simple job, as my existing coding only needs to be modified to use left/join functions between two tables.

    a_survcats
    id bigint(20) NOT NULL auto_increment,
    cat varchar(255) NOT NULL default '',
    info varchar(255) NOT NULL default '',

    "info" contains the following data (there's actually more, but this is just an example):
    Yahoo Search
    Google Search
    MSN Search
    AOL Search

    a_survpicks
    pick varchar(255) NOT NULL default '',

    Data inserted to this table would be (but not limited to):
    Yahoo Search
    Google Search
    Google Search
    Google Search
    AOL Search
    Yahoo Search
    Google Search
    AOL Search
    Yahoo Search
    Google Search
    MSN Search
    AOL Search

    My current MySQL query displays this information in a_survcats, ordered alphabetically. I need the results to display by the # of picks with the highest count, followed by the next highest # of picks, alphabetically if two items have the same number of picks...

    So it'd be as follows:
    Google Search - 5 picks
    AOL Search - 3 picks
    Yahoo Search - 3 picks
    MSN Search - 1 pick.

    The current query I'm using is as follows:
    Code:
    $result=mysql_query("SELECT id,cat,info FROM a_survcats $WHERE ORDER BY cat,info");
    while($tmp=mysql_fetch_array($result)){list($id,$cat,$info)=$tmp;
    $info=stripslashes($info);
    $tp=mysql_fetch_row(mysql_query("select count(id) from a_survpicks WHERE 
    pick='$info'&&dated>='$start'&&dated<='$fin'"));
    $picks=$tp[0];
    $start and $fin are already defined as timestamps (for search capabilities).

    I know this can be done via the join functionality, I just don't know how to do this. For someone that's savvy with PHP/MySQL, this should only take about 5-10 minutes to do. First person to post a solution will be paid $10-$15 via PayPal.

    Need this fairly quick, and it WILL be tested to ensure that it works before payment.

    Thanks for any help that you can provide.
    Douglas Hazard - Certifiable Sports Junkie and Sports Community Enthusiast

    Host of Two Cents Radio - Follow @TwoCentsRadio on Twitter (@BearlyDoug on Twitter)

  2. #2
    Join Date
    Apr 2003
    Location
    Atlanta, Jawja
    Posts
    3,066
    Job fulfilled PRISTINELY by TehBooster! Thank you for bein' such a life saver!
    Douglas Hazard - Certifiable Sports Junkie and Sports Community Enthusiast

    Host of Two Cents Radio - Follow @TwoCentsRadio on Twitter (@BearlyDoug on Twitter)

Posting Permissions

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