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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:57:23+00:00 2026-06-11T06:57:23+00:00

Long time reader, first time poster, so please forgive what could be a stupid

  • 0

Long time reader, first time poster, so please forgive what could be a stupid question…

I have a table in my database (I’m creating a Basketball Fantasy Keeper League Draft) that has the order of the draft (pick number, GM nominated to make that pick, picked player, the time the pick was made [there’s a 12hr draft window] and whether the pick is a keeper pick or not) so what I’m trying to do is detect if the next pick is a keeper pick and if it is, run a few more queries, etc etc. I can do it if there is only ONE keeper pick where a GM would normally make a selection, but what happens if there are 2 or more keeper picks in a row?

So instead of doing a bunch of nested IF statements where I run a query selecting the next pick from the table and checking if it’s a keeper pick or not 3 or 4 times (see below):

$query1Counter = "SELECT counterID FROM draftCounter";
$query1Result=mysql_query($query1Counter);
$livePickCount=mysql_numrows($query1Result);

then:

if ($livePickCount != "") {
    //Do stuff then:
    //run $query1Counter again, then:

    if ($livePickCount != "") {
        //Do stuff then:
        //run $query1Counter again

        if ($livePickCount != "") {
            //Do stuff then:
            //run $query1Counter again
        }
    }
}

I was hoping that I could pull ALL the results from the table like:

query = SELECT * FROM keeperLeagueDraftOrder;
$result=mysql_query($query);

pull out the specific column value like:

$keeperPick=mysql_result($result,$i,"keeperPick");

and then, since it’s either 1 for a Keeper Pick and 0 for a normal pick, possibly do a loop like:

WHILE $keeperPick=1 {
    //Do all the stuff that would skip the row here
}

So that it loops in case there are 2 or more Keeper pics in a row, otherwise, once it gets to the first value where keeperPick==0, then it goes about it’s normal business.

My problem is that I’m not a proper programmer and am only fudging my way through this stuff by googling and copy/pasting and some tweaking where needed, and only used to really simple loops.

Sample table (where the first draft pick has been made as well as 4 Keeper picks nominated [no draft time]):

draftPickID  draftPickPlayerID  draftPickGM  keeperPick  draftTime
1            72                 5            0           2012-09-10 22:04:24
2            10                 3            1           0000-00-10 00:00:00
3            32                 2            1           0000-00-10 00:00:00
4            0                  6            0           0000-00-10 00:00:00
5            0                  1            0           0000-00-10 00:00:00
6            5                  4            1           0000-00-10 00:00:00
7            44                 4            1           0000-00-10 00:00:00
8            0                  1            0           0000-00-10 00:00:00
9            0                  6            0           0000-00-10 00:00:00
10           0                  2            0           0000-00-10 00:00:00
  • 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-11T06:57:24+00:00Added an answer on June 11, 2026 at 6:57 am

    If you are just trying to get the lowest draftPickID out of the database where keeperPick = 0 and draftPickPlayerID = 0, why not just use this database query?

    SELECT * FROM keeperLeagueDraftOrder
    WHERE keeperPick = 0 AND draftPickPlayerID = 0
    ORDER BY draftPickID ASC
    LIMIT 1
    

    This eliminates any need for looping or anything else. It just gets you to the next pick in the draft that requires an actual selection to be made.

    Also, you should really look into using mysqli_* functions as use of the mysql_* functions is discouraged.

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

Sidebar

Related Questions

Long time reader, first time poster. Any help is greatly appreciated. I have crafted
Long time stackoverflow reader, first time poster. Forgive me if I'm not asking a
Long time reader/ first time poster here, with a question I suspect will be
Long time reader, first time poster here. I'm creating a test app that creates
first time poster, long time reader so be gentle with me :) See the
long time reader, first time poster. I’m coming with an issue that many of
Long time reader, first time poster. Working on a web site at http://www.howardpitch.com/ ,
Long time reader, first time poster. I'm a big noob when it comes to
First time poster, long time reader. I've been having a problem with figuring this
Long time reader, first time poster asks: After many weeks of google and forum

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.