Jump to content

Failing_Solutions

Members
  • Posts

    109
  • Joined

  • Last visited

Posts posted by Failing_Solutions

  1. Author suggestion is to ask on the Jqeury forums. Which after a search there nobody answers questions at least related to this plugin.

     

    I tried google and even searched these forums, the plugin seems like its popular but my problem is I don't know how to explain the problem in a way that a search engine knows what I'm looking for. I've even seen example sites that use this plugin and have the same issue, while others don't so I know somebody has figured a way to fix it.

  2. Add this to your head

     

    <script type="text/javascript">
    function showHide (obj) {
    if (obj.style.visibility == "hidden") {
    obj.style.visibility = "visible";
    } else {
    obj.style.visibility = "hidden";
    }
    } 
    </script>

    Add your text box(s) hidden by default to your form

     

    <input type="text" id="Sponsored" style="visibility: hidden;"/>

    <input type="text" id="BannerAds" style="visibility: hidden;"/>

     

    Change your onChange Function to this:

    <select name="select" onChange="showHide(Sponsored);" />

    <option value="select">-select-</option>

                      <option value="Sponsored List">Sponsored List</option>

                      <option value="Banner Ads">Banner Ads</option>

                  </select>

     

    Hope that is what you were after. If you need to do two or more use the option value tag to do it

    <option value="Sponsored List" onSelect="showHide(Sponsored);">Sponsored List</option>

    <option value="Banner Ads" onSelect="showHide(BannerAds);">Banner Ads</option>

     

     

    Good luck

     

  3. If it has been discussed before, my apologies.

     

    Some people here are extremely helpful and while I can thank them in the thread, I certainly wouldn't mind giving them a +1 to their personal rating for whatever its worth. If nothing else if 2 people post solutions to a particular issue, it may help the poster decipher which solution would be best or at least try first.

     

    Just a thought.

     

    Love the forum!

     

     

  4. I'm hoping somebody can answer this, as well as me being able to explain it.

     

    I'm implementing the superfish menu, I have everything but one thing ironed out, and unfortunately there is no good way to explain the issue. But you can reproduce it on the official site in their examples.

     

    I've tested it with IE 8 and 9.

     

    When you click on a menu with sub-menu items IE for a split second loads the text blurry, then it refocuses it and then it looks fine. However, as you can imagine this is very annoying because it happens every time you change menus and on every sub-menu.

     

    Take a look at official site: Example #5 http://users.tpg.com.au/j_birch/plugins/superfish/#sample5 watch carefully as the text loads in IE.

     

    I've updated my jquery, and anything else I could think of and still have no clue. I'm not sure if the dude who wrote it even noticed or felt it was so minor no biggy, or if there is a bug with IE which wouldn't surprise me.

     

    Thoughts comments and help very much appreciated.

     

    Thanks!

  5. That certainly did fix it. Thank you very much for that.

     

    I don't want to impose but I'm learning PHP as I go, mostly I just keep trying stuff till it works. :)

     

    Can you explain what your code is doing there at the end?

     

    I understand the first part just checking if not empty and the values match, but the end part with the ? and : I'm not familiar with sort of functionality.

     

     

  6. I'm trying to set the select to whatever was posted. In this case I'm using dates.

     

    I think I may have my loops wrong. On every post I get the select set to the first date in my date array ($options)

     

    I've tried putting the loops in different places but can't get it right. 

     

    Any help is appreciated.

    <?php
    //Getting the Dates
        $date_query="Select Game_Date from june122011 GROUP BY Game_Date DESC";
    $date_results=mysql_query($date_query); 
    $options="";
    //setting the select as post
    $x="";
    // check if Post Select is set and set x to post
    if (isset($_POST['Select']) AND strlen($_POST['Select']>0)) {
    	$x=$_POST['Select'];
    }
    //loop through dates	
    while ($row=mysql_fetch_array($date_results)) {
    $thedays=$row["Game_Date"];
    //if date = the post set it as selected
    if ($x==$thedays) {
    		$x='selected="selected"';
    	} 
        $options.="<OPTION VALUE=\"$thedays\" $x>".$thedays.'</option>';
    }
    // end getting dates ?>

     

    Then the html part:

    <select name="Select" id="Select" class="select">
          <?php echo $options ?>
        </select>

  7. So records sets start at 0

     

    There is tons of data in the table, but only that one result for the specific query. When I try to echo the result with that query I can't get the GameID or Multiplier

     

    I am using an array though so maybe that is the issue?

     

    $where = '';
    $range = implode(',',range('A','T'));
    foreach($_POST['checkbox'] as $checkbox)
    {
    $where .= "'" . $checkbox . "' IN (" . $range . ") AND ";
    }
    $where .= "Game_Date='" . $select . "'";
    $chunk1 ="SELECT * FROM june122011 Where ";
    $query = $chunk1 . $where;
    $doit=mysql_query($query);
    $results=mysql_fetch_array($doit);

     

    While ($results = mysql_fetch_array($doit)) {
    echo "<tr><td><span class='stdblackbld'>$results[GameID]</span></td>";
    echo "<td class='smallblack'><span class='stdTxtYellowBold'> x$results[Multiplier]</span></td></tr>";
    }

  8. Just noticed an error in the code, change in bold.

     

    <?php

            $city_query="Select DISTINCT city_id, city_name FROM barer";

    $city_results=mysql_query($city_query);

    $optionsid="";

    while ($row=mysql_fetch_array($city_results)) {

    $theid=$row["city_id"];

            $thename=$row["city_name"];

            $optionsid.="<OPTION VALUE=\"$theid\">".$thename.'</option>';

           

    ?>

  9. I ran a SQL query and received 0/0 results but still returned 1 record.

     

    This is causing a problem with my php page because I need to echo the 1 record results. I thought it was a problem with my php code, but after running the query directly in myPhpAdmin I see why it can't echo the results.

     

    Here is a screen shot of the query.

    whats_up_query.gif

     

    Anybody have any idea why this is happening and if there is a way to still echo something like $query['GameID'] when I get a record set like this?

  10. This should help

     

    <?php 
            $city_query="Select DISTINCT city_id, city_name FROM barer";
    $city_results=mysql_query($city_query); 
    $options="";
    while ($row=mysql_fetch_array($city_results)) {
    $theid=$row["city_id"];
            $thename=$row["city_name"];
            $optionsid.="<OPTION VALUE=\"$theid\">".$thename.'</option>';
             
    ?>

     

    The select

    <select name="Select" id="Select" class="select">
          <?php echo $optionsid ?>
        </select>

     

  11. Just wanted to add, the quads is certainly going to cause page load problems. I think what I'll do is run these queries and save the date, pairs, trips and quads in another table entry so I can call them directly. I already have to get the numbers from the lottery daily so running these 3 queries and saving them isn't that big of a deal.

     

    Eventually what I hope to get is a API link to the numbers as they are being drawn and turn this into a page that track hot numbers on a per draw basis so people can log on to the page and find trending pairs, trips, quads ongoing. That will be a challenge but is down the road. Maybe one day it will become an app :)

     

    Really do appreciate the help. I'm going to mark this as solved.

     

    Thanks again!

  12. That looks like it was the solution.

     

    It seems to be working well now.  With this one caveat.

    In my print_r I was getting values like this..

    [10-35] => 72 [35-60] => 70 [42-58] => 68 [35-76] => 68 [35-78] => 66 [32-58] => 64 [1-74] => 64 [29-35] => 64 [35-77] => 64 [33-56] => 64 [20-35] => 62 [12-23] => 62 [35-58] => 62 [56-77] => 60 [10-70] => 60

     

    After checking 10-35, I found it was drawn 35 times which seems like a probable high. Each pair their-after counts down so it seems like its getting the highest to lowest. I switched the code back to the original you wrote.

     

    This:

     //identify all pair combninations
                if($num1==$num2) { continue; }
                $pairKey = "$num1-$num2";
                if(!isset($pairs[$pairKey]))

     

    Now I am seeing this

    [35-10] => 36 [10-35] => 36 [60-35] => 35 [35-60] => 35 [42-58] => 34 [58-42] => 34 [35-76] => 34 [76-35] => 34 [78-35] => 33 [35-78] => 33 [33-56] => 32 [58-32] => 32 [56-33] => 32 [35-77] => 32 [1-74] => 32 [74-1] => 32

     

    As you can see this creates the same pair twice except formatted different 35-10=>36 10-36=>36  add them together and you get 72 which is exactly what the other code was doing ie ( [10-35] => 72 )

     

    Now this pair was drawn 35 times, but its counted as 36 times I had the same issue before in my count statement so I just added a -1 to the count to get the possible games one. I'm not sure why we both are getting an extra count in our code I just assumed it has something do with the way arrays are built. In the end though it looks like it works in that it will get the highest pair.

     

    I'm very happy with this.

     

    Thank you very much for your help, I couldn't have done it anytime soon without your help.

     

     

  13. Yes the numbers aren't in specific columns, they are however arranged from lowest to highest for each game. I've attached my SQL insert statement to this post.

     

    As for the the array, I think its not counting correctly.

     

    I ran a print_r and got alot of pairs, but  the value is always 0.

    Here is a small example of what is outputted with print_r($pairs) *Note all have values of =>0 did I forget an increment step?

    ( [8-65] => 0 [8-29] => 0 [16-18] => 0 [16-24] => 0 [16-34] => 0 [8-24] => 0 [6-75] => 0 [6-34] => 0 [6-38] => 0 [6-49] => 0 [6-63] => 0 [16-45] => 0 [16-71] => 0 [18-75] => 0 [24-26] => 0 [24-29] => 0 [24-49] => 0 [18-65] => 0 [18-63] => 0 [16-73] => 0 [18-26] => 0 [18-38] => 0 [18-49] => 0 [6-32] => 0 [6-29] => 0 [58-59] => 0 [44-67] => 0 [59-74] => 0 [60-67] => 0 [60-74] => 0 [43-60] => 0 [43-44] => 0 [40-74] => 0 [41-43] => 0 [41-58] => 0 [41-74] => 0 [65-74] => 0 [1-6] => 0 [1-75] => 0 [6-16] => 0 [6-24] => 0 [6-26] => 0 [1-71] => 0 [1-63] => 0 [1-24] => 0 [1-32] => 0 [1-38] => 0 [1-45] => 0 [24-67] => 0 [24-73] => 0 [49-73] => 0 [49-71] => 0 [49-80] => 0 [63-71] => 0 [63-73] => 0 [49-63] => 0 [45-75] => 0 [38-67] => 0 [38-71] => 0 [38-73] => 0 [45-49] => 0 [65-80] => 0 [67-73] => 0 [2-21] => 0 [2-25] => 0 [2-27] => 0 [2-36] => 0 [2-9] => 0 [2-3] => 0 [67-75] => 0 [71-73] => 0 [71-80] => 0 [73-75] => 0 [38-65] => 0 [38-49] => 0 [29-32] => 0 [29-34] => 0 [29-38] => 0 [29-45] => 0 [26-80] => 0 [26-73] => 0 [26-32] => 0 [26-34] => 0 [26-38] => 0 [26-71] => 0 [29-63] => 0 [29-71] => 0 [34-45] => 0 [34-49] => 0 [34-67] => 0 [38-45] => 0 [32-73] => 0 [32-49] => 0 [29-73] => 0 [29-75] => 0 [29-80] => 0 [32-45] => 0 [40-65] => 0 [40-60] => 0 [37-69] => 0 [37-61] => 0 [37-79] => 0 [43-47] => 0 [43-61] => 0 [37-47] => 0 [37-43] => 0 [29-61] => 0 [29-69] => 0 [29-72] => 0 [29-74] => 0 [43-69] => 0 [43-74] => 0 [58-69] => 0 [58-79] => 0 [61-79] => 0 [69-74] => 0 [56-61] => 0 [47-79] => 0 [47-56] => 0 [47-58] => 0 [47-69] => 0 [47-74] => 0 [29-58] => 0 [29-56] => 0 [25-43] => 0 [25-37] => 0 [25-47] => 0 [25-56] => 0 [25-69] => 0 [25-29] => 0 [25-27] => 0 [23-61] => 0 [23-69] => 0 [23-72] => 0 [23-79] => 0 [25-79] => 0 [27-29] => 0 [28-72] => 0 [29-37] => 0 [29-43] => 0 [29-47] => 0 [28-69] => 0 [28-47] => 0 [27-37] => 0 [27-69] => 0 [28-37] => 0 [28-43] => 0 [69-79] => 0 [72-74] => 0 [35-43] => 0 [35-37] => 0 [35-44] => 0 [35-58] => 0 [35-60] => 0 [35-36] => 0 [33-67] => 0 [33-35] => 0 [33-40] => 0 [33-43] => 0 [33-65] => 0 [35-74] => 0 [36-37] => 0 [37-65] => 0 [40-43] => 0 [40-44] => 0 [40-58] => 0 [37-60] => 0 [37-40] => 0 [36-40] => 0 [36-41] => 0 [36-58] => 0 [36-74] => 0 [31-74] => 0 [31-44] => 0 [7-41] => 0 [7-65] => 0 [7-67] => 0 [20-60] => 0 [7-40] => 0 [7-37] => 0 [4-29] => 0 [7-29] => 0 [7-35] => 0 [7-36] => 0 [27-35] => 0 [27-40] => 0 [29-44] => 0 [29-59] => 0 [29-60] => 0 [31-37] => 0 [29-41] => 0 [29-40] => 0 [27-41] => 0 [29-31] => 0 [29-33] => 0 [29-36] => 0 [2-60] => 0 [2-69] => 0 [11-80] => 0 [11-60] => 0 [14-15] => 0 [14-33] => 0 [14-35] => 0 [11-57] => 0 [11-54] => 0 [10-57] => 0 [11-33] => 0 [11-44] => 0 [11-51] => 0 [14-51] => 0 [14-54] => 0 [24-54] => 0 [24-74] => 0 [24-79] => 0 [26-51] => 0 [18-57] => 0 [15-60] => 0 [14-56] => 0 [14-74] => 0 [14-79] => 0 [15-18] => 0 [10-56] => 0 [10-54] => 0 [53-67] => 0 [50-70] => 0 [53-70] => 0 [70-77] => 0 [71-77] => 0 [50-53] => 0 [41-77] => 0 [35-70] => 0 [41-53] => 0 [41-70] => 0 [41-71] => 0 [1-3] => 0 [1-14] => 0 [3-33] => 0 [3-44] => 0 [3-57] => 0 [10-51] => 0 [3-26] => 0 [1-60] => 0 [1-51] => 0 [1-54] => 0 [1-56] => 0 [1-57] => 0 [26-54] => 0 [26-74] => 0 [7-64] => 0 [7-54] => 0 [7-69] => 0 [13-24] => 0 [13-33] => 0 [7-34] => 0 [7-13] => 0 [5-69] => 0 [6-37] => 0 [6-54] => 0 [6-58] => 0 [13-34] => 0 [13-37] => 0 [16-33] => 0 [16-36] => 0 [16-37] => 0 [16-54] => 0 [16-31] => 0 [16-22] => 0 [13-54] => 0 [13-58] => 0 [13-64] => 0 [16-17] => 0 [5-34] => 0 [5-13] => 0 [54-57] => 0 [54-60] => 0 [54-79] => 0 [57-74] => 0 [51-79] => 0 [51-60] => 0 [33-54] => 0 [35-57] => 0 [44-54] => 0 [44-79] => 0 [2-5] => 0 [2-6] => 0 [2-54] => 0 [2-57] => 0 [2-58] => 0 [2-64] => 0 [2-37] => 0 [2-34] => 0 [2-7] => 0 [2-17] => 0 [2-24] => 0 [2-33] => 0 [33-77] => 0 [33-71] => 0 [30-42] => 0 [25-71] => 0 [30-79] => 0 [31-42] => 0 [31-69] => 0 [25-60] => 0 [25-50] => 0 [25-35] => 0 [25-36] => 0 [25-42] => 0 [25-46] => 0 [31-79] => 0 [35-71] => 0 [50-60] => 0 [50-69] => 0 [50-71] => 0 [60-71] => 0 [42-76] => 0 [42-71] => 0 [36-50] => 0 [36-69] => 0 [36-76] => 0 [42-69] => 0 

     

    Here is the code with your changes suggested.

    $query = "SELECT `A`,`B`,`C`,`D`,`E`,`F`,`G`,`H`,`I`,`J`,`K`,`L`,`M`,`N`,`O`,`P`,`Q`,`R`,`S`,`T` FROM june122011 WHERE Game_Date = '2011/6/16'";
    $result = mysql_query($query);
    
    //Arrays to hold values
    $pairs = array();
    $trips = array();
    $quads = array();
    
    while($draw = mysql_fetch_assoc($result))
    {
        foreach($draw as $num1)
        {
            foreach($draw as $num2)
            {
                //identify all pair combination's
                if($num1==$num2) { continue; }
                $pairKeyAry = array($num1, $num2);
    		sort($pairKeyAry);
    		$pairKey = implode('-', $pairKeyAry);
                if(!isset($pairs[$pairKey]))
                {
                    //Create the pair record if not exist
                    $pairs[$pairKey] = 0;
                }
                //Increment pair record by 1
                $pairs[$pairKey] =0;
    /*
                //Identify all trip combinations
                foreach($draw as $num3)
                {
                    //identify all pair combninations
                    if($num1==$num2 || $num1==$num3 || $num2==$num3) { continue; }
                    $tripKey = "$num1-$num2-$num3";
                    if(!isset($trips[$tripKey]))
                    {
                        //Create the pair record if not exist
                        $trips[$tripKey] = 0;
                    }
                    //Increment pair record by 1
                    $trips[$tripKey] = 0;
    
                    //Identify all quad combinations
                    foreach($draw as $num4)
                    {
                        //identify all pair combninations
                        if($num1==$num2 || $num1==$num3 || $num1==$num4 ||
                           $num2==$num3 || $num2==$num4 || $num3==$num4) { continue; }
                        $quadKey = "$num1-$num2-$num3-$num4";
                        if(!isset($quads[$quadKey]))
                        {
                            //Create the pair record if not exist
                            $quads[$quadKey] = 0;
                        }
                        //Increment pair record by 1
                        $quads[$quadKey] = 0;
                    } #END Quad Check
                }#END Trip check
    */
            }#END pair check
        }
    }
    
    
    //Sort arrays highest to lowest
    arsort($pairs);
    print_r($pairs);
    arsort($trips);
    arsort($quads);
    
    //Get most common 
    $mostCommonPair = key($pairs); //E.g. 15-37
    $mostCommonTrip = key($trips); //E.g. 8-14-35
    $mostCommonQuad = key($quads); //E.g. 16-32-40-52
    echo "<font color='#660000' ><br><b>The Most Common Pairs is ".$mostCommonPair."</b></font>";
    ?>

     

    I have the manual part working as if I test 2 numbers on my page I'll get accurate counts for that pair. Tested this in SQL. This function you're helping me with here will be in a info box stating hot pair for $date was x,y , hot trips were x,y,z etc..

     

     

     

    [attachment deleted by admin]

  14. Wow that is certainly great work there. I really appreciate the effort and your time.

     

    I'm still digesting it to understand just how it works.

     

    Right now, I have it running just the pairs on my keno page its not taking to long to load the page which is good.

     

    I'll work on incorporating a cron job once I start working on the final page design.

     

    One thing I did notice, and maybe its something I'm overlooking right now is that while the code is giving me a pair, its not necessarily the most drawn pair. Any ideas why that would be? Maybe I'm not echoing it correctly??

     

    Here is the code I'm running (basically your code) just removed the $ from the while and added an echo and a valid select statement.

    <?php
    
    $query = "SELECT `A`,`B`,`C`,`D`,`E`,`F`,`G`,`H`,`I`,`J`,`K`,`L`,`M`,`N`,`O`,`P`,`Q`,`R`,`S`,`T` FROM june122011 WHERE Game_Date = '2011/6/16'";
    $result = mysql_query($query);
    
    //Arrays to hold values
    $pairs = array();
    $trips = array();
    $quads = array();
    
    while($draw = mysql_fetch_assoc($result))
    {
        foreach($draw as $num1)
        {
            foreach($draw as $num2)
            {
                //identify all pair combninations
                if($num1==$num2) { continue; }
                $pairKey = "$num1-$num2";
                if(!isset($pairs[$pairKey]))
                {
                    //Create the pair record if not exist
                    $pairs[$pairKey] = 0;
                }
                //Increment pair record by 1
                $pairs[$pairKey] = 0;
    /*
                //Identify all trip combinations
                foreach($draw as $num3)
                {
                    //identify all pair combninations
                    if($num1==$num2 || $num1==$num3 || $num2==$num3) { continue; }
                    $tripKey = "$num1-$num2=$num3";
                    if(!isset($trips[$tripKey]))
                    {
                        //Create the pair record if not exist
                        $trips[$tripKey] = 0;
                    }
                    //Increment pair record by 1
                    $trips[$tripKey] = 0;
    
                    //Identify all quad combinations
                    foreach($draw as $num4)
                    {
                        //identify all pair combninations
                        if($num1==$num2 || $num1==$num3 || $num1==$num4 ||
                           $num2==$num3 || $num2==$num4 || $num3==$num4) { continue; }
                        $quadKey = "$num1-$num2=$num3";
                        if(!isset($quads[$quadKey]))
                        {
                            //Create the pair record if not exist
                            $quads[$quadKey] = 0;
                        }
                        //Increment pair record by 1
                        $quads[$quadKey] = 0;
                    } #END Quad Check
                }#END Trip check
    */
            }#END pair check
        }
    }
    
    
    //Sort arrays highest to lowest
    arsort($pairs);
    arsort($trips);
    arsort($quads);
    
    //Get most common 
    $mostCommonPair = key($pairs); //E.g. 15-37
    $mostCommonTrip = key($trips); //E.g. 8-14-35
    $mostCommonQuad = key($quads); //E.g. 16-32-40-52
    echo "<font color='#660000' ><br><b>The Most Common Pairs is ".$mostCommonPair."</b></font>";
    ?>

     

    For June 16th it pulls 24-16 as the pairs.  Which if I punch in manually comes up as 21 hits. But the pair 35, 77 was drawn 31 times. Here is some screen shots to show what I mean on the results.

     

    I can put this on my test server if you want to play with it, right now i'm just running it on Xammp.

     

    Here is the initial Load Page (note the Hot Pair at the bottom)

    Pairs_01.gif

     

    Here is the Count using the manual query for those 2 numbers.

    Pairs_02.gif

     

    And finally here is a the count on 35,77 manually entered.

    Pairs_03.gif

     

    Again, I'm not sure if there is something I need to do like a Max, or Count on the $mostCommonPair. I've never used those outside of SQL and not sure how they exactly work in PHP. I certainly didn't expect you to spend this much time on a question like this, it really is appreciated. If nothing else I'm learning something. So thank you very much.

     

     

     

  15. That makes since, can you point me to an example of how you search an array for criteria? And extract the results into something you can echo / print.

     

    Everything I know about PHP and SQL has been self taught and from help on these forums. Any example you can give or show me would be very helpful.

     

    Thank you.

     

     

  16. Hi, I'm trying to wrap my head around how to count how many times pairs, triples, quads appear in my database. Then return the ones that appear the most.

     

    What I'm doing is working on a way to find "hot numbers" from a Keno game.

    Each game there are 20 numbers drawn.

    The numbers can range from 1 to 80.

    There are 306 games a day.

     

    I want to count how many times: (1,2) (1,3) (1,4) (1,5)... (1,80) then loop to (2,3) (2,4) (2,5)...(2,80) all the way up to (79,80). Count how many time each pair appeared that day then return the pair that appeared the most. So I could say on 6/16/2011 the hottest pair was (X,Y)

     

    I have 2 issues.

    1 I'm not sure how to count up to max making sure I get all the possible pairs without hitting duplicates.

    2, I'm not sure how to return the results.

     

    As for counting I tried this,

    <?php
    $i=1;
    $j=2;
    While ($i<=80 ) {
    While ($j<=80) {
    echo "$i,$j<br>";
    $j++;
    }
    echo "$i,$j<br>";
    $i++;
    }
    ?>

    But only got 1,80 then 2,81: 3,81.. ect.

     

    As for problem 2, I tried to just find just 1 number that appeared the most times in 1 day but not having much luck.

     

    $x=1;
    While ($x<=80) {
    $hot1=mysql_query("Select Count(*) as Hot_Single FROM june122011 Where $x IN (`A`,`B`,`C`,`D`,`E`,`F`,`G`,`H`,`I`,`J`,`K`,`L`,`M`,`N`,`O`,`P`,`Q`,`R`,`S`,`T`) and Game_Date='2011/6/15'");
    $hot1results = mysql_fetch_array($hot1);
    $x++;
    }
    echo $hot1results['Hot_Single'];

     

     

    Any help is appreciated.

     

  17. Thank you both,

     

    redixx that example was great.

     

    PFMaBiSmAd after following your advise I was finally able to get the query to execute correctly.

     

    I ended up with this in working order. Just a few more things to add now.

    $where = '';
    $range = implode(',',range('A','T'));
    foreach($_POST['checkbox'] as $checkbox)
    {
    $where .= "'" . $checkbox . "' IN (" . $range . ") AND ";
    }
    $where .= "Game_Date='" . $select . "'";
    $chunk1 ="SELECT * FROM june122011 Where ";
    $query = $chunk1 . $where;
    $doit=mysql_query($query);
    $results=mysql_fetch_array($doit);
    $num_rows = mysql_num_rows($doit);
    $adjustedvalue = $num_rows-1;
    echo "<table><br>You would have won <font color='red'> $adjustedvalue times</font>";
    While ($results = mysql_fetch_array($doit)) {
    echo "<tr><td>$results[GameID]</td></tr>";
    }
    echo "</tabele>";

     

    Many thanks for all the help.

     

  18. Thanks for the reply,

    I think I understand most of that,

    It looked like though it would only process 1 number at a time. Unless I looked at it wrong.

     

     

    While I need it to check the all number selected in the checkboxs so it would have to have up to 9 AND statements in the select.

    Where checkbox[0] AND checkbox[1] etc.... That why I was hoping to be able to extract each checkbox value and turn them into seperate variables so I could write a case statement based on how many checkboxes were selected and then the 10 queries.

     

     

    That said I did try to run it with just 1 number and got an error

    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\PhpStuff\keno.php on line 90

    I used this code to test the query:

    $where = '';
    $range = implode(',',range('A','T'));
    foreach($_POST['checkbox'] as $checkbox)
    {
    $where .= "'" . $checkbox . "' IN (" . $range . ") AND ";
    }
    $where .= "Game_Date='" . $select . "'";
    $query = mysql_query("SELECT * FROM june122011 " . $where);
    $results = mysql_fetch_array($query);
    While ($results = mysql_fetch_array($query)) {
    echo "$results[Game_Id]";
    }

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.