PHP Mystery
Moderator: General Moderators
PHP Mystery
Here is something very strange:
Why does this NOT work when I use the $lt variable, but does if I copy and paste the select string verbatim:
*************This returns nothing*********************
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query($lt);
While ($row28 = mysql_fetch_array($rs28))
{
}
*************This WORKS*********************
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query("SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)");
While ($row28 = mysql_fetch_array($rs28))
{
}
Why does this NOT work when I use the $lt variable, but does if I copy and paste the select string verbatim:
*************This returns nothing*********************
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query($lt);
While ($row28 = mysql_fetch_array($rs28))
{
}
*************This WORKS*********************
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query("SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)");
While ($row28 = mysql_fetch_array($rs28))
{
}
Re: PHP Mystery
In the first you don't define $b. The query is
And no, the $b you have in the foreach later does not affect it.
Code: Select all
SELECT * FROM $table where Date >= '???' and (Ball1 = or Ball2 = or Ball3 = or Ball4 = or Ball5 = )Re: PHP Mystery
Thanks for the reply. I guess my confusion comes in in that I am trying to use the literal string itself. I turned it into the variable $lt plugged it into the query and it won't work, but below it that same string verbatim works. Shouldn't it see $b the same in both? Shouldn't these two query formats produce the exact same result?
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
$rs28 = mysql_query($lt);
**Verses***
$rs28 = mysql_query("SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)");
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
$rs28 = mysql_query($lt);
**Verses***
$rs28 = mysql_query("SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)");
Re: PHP Mystery
There's no "delayed interpretation" in PHP. When you say $a = $b it happens then and there: it doesn't wait until you try to use $a.
The first time you define $lt there is no value for $b. The query will not work because it's missing information.
The second time you define $lt there is a $b and the query works.
Code: Select all
$a = $b;
$b = 5;
echo $a; // nothing
$a = $b;
echo $a; // 5The second time you define $lt there is a $b and the query works.
Re: PHP Mystery
I see. Thanks. Any suggestions.? I am trying make it so I can replace the string with a variable for that query.
Re: PHP Mystery
What's the rest of the code? There's probably a more efficient way than the working method you have now.
Re: PHP Mystery
its not pretty, but what this code does its pull numbers from a database, count the number of times that it appears and displays the % of appearances based on the number of drawings. I can get that to work with no problem. What I am trying to do here is use the switch statement to select the table and approptiate number of balls in a select statement that correspond to any particular drawing. It is pulling the table name from the post and the select statement I was trying to turn into a variable:
<?php
// $lottoid = $_POST['pulldownmenu'];
//'lotto1b3.php?lotto_id' = $lottoid ;
//print "<img src=greyanalyzernewest2copy.png width=975 height=700 />";
include ("connect_lotto.php");
$rs14a = mysql_query("truncate table my$table8");
$rs14b = mysql_query("truncate table my$table8b");
$rs14c = mysql_query("truncate table $table9");
$rs15 = mysql_query("truncate table $table10");
$rs16 = mysql_query("truncate table $table11");
$rs14e = mysql_query("truncate table $table14");
$rs14f = mysql_query("truncate table $table14b");
$rs14g = mysql_query("truncate table gen1");
$rs14h = mysql_query("truncate table $table14i");
$rs14i = mysql_query("truncate table $table14bi");
print "<div id=radio2>";
print " <font size=4 color=#009933> To start your analysis:</font><ol>";
print "<p><font size=2 color=#009933>1. Put in a date from which to start your search. Ex:Putting in 12-24-2008 would search all drawings from that date forward<p>
<p><font size=2 color=#009933> to the most recent drawing date.</font></p> ";
print"<p><font size=2 color=#F00000>2. **Anything more than a 1 year search may not be as effective for true ball pattern analysis.</font> .</font></p> " ;
print "</div>";
print "<div id=radio>";
print "<form action='' method=post>";
print " <input type=text name=month size=2> <input type=text name=day size=2> <input type=text name=year size=4>";
print "<input name=Go type=submit value=Go />";
print "</form>";
print "</div>";
print "<div id=dateformat>";
print "<font color=#FFFFFF font size=2> <b>Month Day Year</b></font>";
print "</div>";
print "<div id=checknum>";
print "<a href=checknummeg2.php>Check Your Numbers To See You've Won.</a>";
print "</div>";
//include ("join.php");
print "<div id=hot5>";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
//$date = $year."-".$month."-".$day;
$date = '2008-01-01';
$rs20 = mysql_query("CREATE TEMPORARY TABLE $temptable1 (Num VARCHAR(2),Count VARCHAR(2))");
//$rs14 = mysql_query("CREATE TEMPORARY TABLE tempmega9 (id int auto_increment primary key,Ball1 VARCHAR(2)");
if ($_POST['Go'] == 'Go')
{
print "<div id=switch>";
$destination = $_POST["pulldownmenu"];
switch ($destination){
case "MegaMillions":
$table = 'mega';
$lotto = 'Mega Millions' ;
$state2 = 'MegaMillions';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b' ;
break;
case "PowerBall":
$lotto = 'Power Millions' ;
$table = 'powerball';
$state2 = 'PowerBall';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b';
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59");
break;
}
//print "<div id=gen2>";
//print "<a href=gen.php>Generate Your Numbers To Play.</a>";
//print "</div>";
print "<tr>";
//print "<font size=1 color=#FFFFFF> (Hot Numbers are numbers that have shown a tendency to appear more frequently over a given date range.)</font><br>";
print "</tr>";
//print "<font color=#FFFFFF> Hot Numbers</font>. ";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query($lt);
While ($row28 = mysql_fetch_array($rs28))
{
$num_rows28 = mysql_num_rows($rs28);
$num28 = $num_rows28;
$bee28 = $b;
$bll = $row28['id'];
$blldate = $row28['Date'];
$bll1 = $row28['Ball1'];
$bll2 = $row28['Ball2'];
$bll3 = $row28['Ball3'];
$bll4 = $row28['Ball4'];
$bll5 = $row28['Ball5'];
}
$rs21 = mysql_query ("INSERT IGNORE into $temptable1 (Num,Count) Values ($bee28,$num28)");
$rs29 = mysql_query("SELECT * FROM $table where Date >= '$date'");
While ($row29 = mysql_fetch_array($rs29))
{
$num_rows29 = mysql_num_rows($rs29);
$num29 = $num_rows29;
$bee29 = $b;
}
}
if ($num29 < 15)
{
$pernum = 25;
}
if ($num29 >= 15 and $num29 < 50)
{
$pernum = 15;
}
if ($num29 >= 50 and $num29 < 100)
{
$pernum = 14;
}
if ($num29 >= 100 and $num29 < 150)
{
$pernum = 12;
}
if ($num29 >= 150 and $num29 < 200)
{
$pernum = 11.5;
}
if ($num29 >= 200 and $num29 < 300)
{
$pernum = 11.3;
}
if ($num29 >= 300 )
{
$pernum = 11.17;
}
$rs25 = mysql_query ("select DISTINCT * from $temptable1");
while($row25 = mysql_fetch_array($rs25)){
$num_rows25 = mysql_num_rows($rs25);
$cnt = $row25['Count'];
$mynum = $row25['Num'];
$per = $cnt/$num29*100;
if($per > 10.16)
{
$rs19 = mysql_query ("INSERT into $table9 (Ball1 ) Values ($mynum)");
}
$perfrm = number_format($per,3);
Print "<option value=$mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers> $mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers</option>" ;
}
print "</select>";
print "</form>";
//*****88888***************
//***************************
print "</div>"."<br>";
//*****************************
include ("rhfmegabonus.php");
mysql_close();
}
<?php
// $lottoid = $_POST['pulldownmenu'];
//'lotto1b3.php?lotto_id' = $lottoid ;
//print "<img src=greyanalyzernewest2copy.png width=975 height=700 />";
include ("connect_lotto.php");
$rs14a = mysql_query("truncate table my$table8");
$rs14b = mysql_query("truncate table my$table8b");
$rs14c = mysql_query("truncate table $table9");
$rs15 = mysql_query("truncate table $table10");
$rs16 = mysql_query("truncate table $table11");
$rs14e = mysql_query("truncate table $table14");
$rs14f = mysql_query("truncate table $table14b");
$rs14g = mysql_query("truncate table gen1");
$rs14h = mysql_query("truncate table $table14i");
$rs14i = mysql_query("truncate table $table14bi");
print "<div id=radio2>";
print " <font size=4 color=#009933> To start your analysis:</font><ol>";
print "<p><font size=2 color=#009933>1. Put in a date from which to start your search. Ex:Putting in 12-24-2008 would search all drawings from that date forward<p>
<p><font size=2 color=#009933> to the most recent drawing date.</font></p> ";
print"<p><font size=2 color=#F00000>2. **Anything more than a 1 year search may not be as effective for true ball pattern analysis.</font> .</font></p> " ;
print "</div>";
print "<div id=radio>";
print "<form action='' method=post>";
print " <input type=text name=month size=2> <input type=text name=day size=2> <input type=text name=year size=4>";
print "<input name=Go type=submit value=Go />";
print "</form>";
print "</div>";
print "<div id=dateformat>";
print "<font color=#FFFFFF font size=2> <b>Month Day Year</b></font>";
print "</div>";
print "<div id=checknum>";
print "<a href=checknummeg2.php>Check Your Numbers To See You've Won.</a>";
print "</div>";
//include ("join.php");
print "<div id=hot5>";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
//$date = $year."-".$month."-".$day;
$date = '2008-01-01';
$rs20 = mysql_query("CREATE TEMPORARY TABLE $temptable1 (Num VARCHAR(2),Count VARCHAR(2))");
//$rs14 = mysql_query("CREATE TEMPORARY TABLE tempmega9 (id int auto_increment primary key,Ball1 VARCHAR(2)");
if ($_POST['Go'] == 'Go')
{
print "<div id=switch>";
$destination = $_POST["pulldownmenu"];
switch ($destination){
case "MegaMillions":
$table = 'mega';
$lotto = 'Mega Millions' ;
$state2 = 'MegaMillions';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b' ;
break;
case "PowerBall":
$lotto = 'Power Millions' ;
$table = 'powerball';
$state2 = 'PowerBall';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b';
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59");
break;
}
//print "<div id=gen2>";
//print "<a href=gen.php>Generate Your Numbers To Play.</a>";
//print "</div>";
print "<tr>";
//print "<font size=1 color=#FFFFFF> (Hot Numbers are numbers that have shown a tendency to appear more frequently over a given date range.)</font><br>";
print "</tr>";
//print "<font color=#FFFFFF> Hot Numbers</font>. ";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query($lt);
While ($row28 = mysql_fetch_array($rs28))
{
$num_rows28 = mysql_num_rows($rs28);
$num28 = $num_rows28;
$bee28 = $b;
$bll = $row28['id'];
$blldate = $row28['Date'];
$bll1 = $row28['Ball1'];
$bll2 = $row28['Ball2'];
$bll3 = $row28['Ball3'];
$bll4 = $row28['Ball4'];
$bll5 = $row28['Ball5'];
}
$rs21 = mysql_query ("INSERT IGNORE into $temptable1 (Num,Count) Values ($bee28,$num28)");
$rs29 = mysql_query("SELECT * FROM $table where Date >= '$date'");
While ($row29 = mysql_fetch_array($rs29))
{
$num_rows29 = mysql_num_rows($rs29);
$num29 = $num_rows29;
$bee29 = $b;
}
}
if ($num29 < 15)
{
$pernum = 25;
}
if ($num29 >= 15 and $num29 < 50)
{
$pernum = 15;
}
if ($num29 >= 50 and $num29 < 100)
{
$pernum = 14;
}
if ($num29 >= 100 and $num29 < 150)
{
$pernum = 12;
}
if ($num29 >= 150 and $num29 < 200)
{
$pernum = 11.5;
}
if ($num29 >= 200 and $num29 < 300)
{
$pernum = 11.3;
}
if ($num29 >= 300 )
{
$pernum = 11.17;
}
$rs25 = mysql_query ("select DISTINCT * from $temptable1");
while($row25 = mysql_fetch_array($rs25)){
$num_rows25 = mysql_num_rows($rs25);
$cnt = $row25['Count'];
$mynum = $row25['Num'];
$per = $cnt/$num29*100;
if($per > 10.16)
{
$rs19 = mysql_query ("INSERT into $table9 (Ball1 ) Values ($mynum)");
}
$perfrm = number_format($per,3);
Print "<option value=$mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers> $mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers</option>" ;
}
print "</select>";
print "</form>";
//*****88888***************
//***************************
print "</div>"."<br>";
//*****************************
include ("rhfmegabonus.php");
mysql_close();
}
Re: PHP Mystery
Before anything else, edit your post and put tags around that huge thing.
Code: Select all
Re: PHP Mystery
Sorry here it is edited: The form pulls its post data from the index page that has a dropdown with lottery names.
<?php
include ("connect_lotto.php");
$rs14a = mysql_query("truncate table my$table8");
$rs14b = mysql_query("truncate table my$table8b");
$rs14c = mysql_query("truncate table $table9");
$rs15 = mysql_query("truncate table $table10");
$rs16 = mysql_query("truncate table $table11");
print "<div id=radio2>";
print " <font size=4 color=#009933> To start your analysis:</font><ol>";
print "<p><font size=2 color=#009933>1. Put in a date from which to start your search. Ex:Putting in 12-24-2008 would search all drawings from that date forward<p>
<p><font size=2 color=#009933> to the most recent drawing date.</font></p> ";
print"<p><font size=2 color=#F00000>2. **Anything more than a 1 year search may not be as effective for true ball pattern analysis.</font> .</font></p> " ;
print "</div>";
print "<div id=radio>";
print "<form action='' method=post>";
print " <input type=text name=month size=2> <input type=text name=day size=2> <input type=text name=year size=4>";
print "<input name=Go type=submit value=Go />";
print "</form>";
print "</div>";
print "<div id=dateformat>";
print "<font color=#FFFFFF font size=2> <b>Month Day Year</b></font>";
print "</div>";
//*****************Begin database search***************8
print "<div id=hot5>";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
$state2 = 'PowerBall';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b';
//$date = $year."-".$month."-".$day;
// it uses this date to search from
$date = '2008-01-01';
$rs20 = mysql_query("CREATE TEMPORARY TABLE $temptable1 (Num VARCHAR(2),Count VARCHAR(2))");
//$rs14 = mysql_query("CREATE TEMPORARY TABLE tempmega9 (id int auto_increment primary key,Ball1 VARCHAR(2)");
if ($_POST['Go'] == 'Go')
{
print "<div id=switch>";
$destination = $_POST["pulldownmenu"];
echo "Lottery $destination<br />";
switch ($destination){
case "MegaMillions":
$table = 'mega';
$lotto = 'Mega Millions' ;
$state2 = 'Mega';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b' ;
break;
case "PowerBall":
$lotto = 'Power Millions' ;
$table = 'powerball';
$state2 = 'PowerBall';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b';
break;
}
//print "<div id=gen2>";
//print "<a href=gen.php>Generate Your Numbers To Play.</a>";
//print "</div>";
print "<tr>";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
// I would like to use this variable
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query("SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)");
While ($row28 = mysql_fetch_array($rs28))
{
$num_rows28 = mysql_num_rows($rs28);
$num28 = $num_rows28;
$bee28 = $b;
$bll = $row28['id'];
$blldate = $row28['Date'];
$bll1 = $row28['Ball1'];
$bll2 = $row28['Ball2'];
$bll3 = $row28['Ball3'];
$bll4 = $row28['Ball4'];
$bll5 = $row28['Ball5'];
}
$rs21 = mysql_query ("INSERT IGNORE into $temptable1 (Num,Count) Values ($bee28,$num28)");
$rs29 = mysql_query("SELECT * FROM $table where Date >= '$date'");
While ($row29 = mysql_fetch_array($rs29))
{
$num_rows29 = mysql_num_rows($rs29);
$num29 = $num_rows29;
$bee29 = $b;
}
}
$perfrm = number_format($per,3);
Print "<option value=$mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers> $mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers</option>" ;
}
print "</select>";
print "</form>";
print "</div>"."<br>";
//*****************************
mysql_close();
?>
<?php
include ("connect_lotto.php");
$rs14a = mysql_query("truncate table my$table8");
$rs14b = mysql_query("truncate table my$table8b");
$rs14c = mysql_query("truncate table $table9");
$rs15 = mysql_query("truncate table $table10");
$rs16 = mysql_query("truncate table $table11");
print "<div id=radio2>";
print " <font size=4 color=#009933> To start your analysis:</font><ol>";
print "<p><font size=2 color=#009933>1. Put in a date from which to start your search. Ex:Putting in 12-24-2008 would search all drawings from that date forward<p>
<p><font size=2 color=#009933> to the most recent drawing date.</font></p> ";
print"<p><font size=2 color=#F00000>2. **Anything more than a 1 year search may not be as effective for true ball pattern analysis.</font> .</font></p> " ;
print "</div>";
print "<div id=radio>";
print "<form action='' method=post>";
print " <input type=text name=month size=2> <input type=text name=day size=2> <input type=text name=year size=4>";
print "<input name=Go type=submit value=Go />";
print "</form>";
print "</div>";
print "<div id=dateformat>";
print "<font color=#FFFFFF font size=2> <b>Month Day Year</b></font>";
print "</div>";
//*****************Begin database search***************8
print "<div id=hot5>";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
$year = $_POST['year'];
$month = $_POST['month'];
$day = $_POST['day'];
$state2 = 'PowerBall';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b';
//$date = $year."-".$month."-".$day;
// it uses this date to search from
$date = '2008-01-01';
$rs20 = mysql_query("CREATE TEMPORARY TABLE $temptable1 (Num VARCHAR(2),Count VARCHAR(2))");
//$rs14 = mysql_query("CREATE TEMPORARY TABLE tempmega9 (id int auto_increment primary key,Ball1 VARCHAR(2)");
if ($_POST['Go'] == 'Go')
{
print "<div id=switch>";
$destination = $_POST["pulldownmenu"];
echo "Lottery $destination<br />";
switch ($destination){
case "MegaMillions":
$table = 'mega';
$lotto = 'Mega Millions' ;
$state2 = 'Mega';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b' ;
break;
case "PowerBall":
$lotto = 'Power Millions' ;
$table = 'powerball';
$state2 = 'PowerBall';
$temptable1 = 'tempmymega8i';
$temptable2b = 'tempmymega82';
$temptable3c = 'tempmymega83';
$temptable4d = 'tempmymega84';
$temptable4be = 'tempmymega84b';
$temptable5f = 'tempmymega85';
$temptable5bg = 'tempmymega85b';
$temptable6h = 'tempmymega86';
$temptable6bi = 'tempmymega86b';
break;
}
//print "<div id=gen2>";
//print "<a href=gen.php>Generate Your Numbers To Play.</a>";
//print "</div>";
print "<tr>";
$ball1=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56");
// I would like to use this variable
$lt = "SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)";
print "<form>";
print "<select>";
foreach ($ball1 as $b )
{
$rs28 = mysql_query("SELECT * FROM $table where Date >= '$date' and (Ball1 = $b or Ball2 = $b or Ball3 = $b or Ball4 = $b or Ball5 = $b)");
While ($row28 = mysql_fetch_array($rs28))
{
$num_rows28 = mysql_num_rows($rs28);
$num28 = $num_rows28;
$bee28 = $b;
$bll = $row28['id'];
$blldate = $row28['Date'];
$bll1 = $row28['Ball1'];
$bll2 = $row28['Ball2'];
$bll3 = $row28['Ball3'];
$bll4 = $row28['Ball4'];
$bll5 = $row28['Ball5'];
}
$rs21 = mysql_query ("INSERT IGNORE into $temptable1 (Num,Count) Values ($bee28,$num28)");
$rs29 = mysql_query("SELECT * FROM $table where Date >= '$date'");
While ($row29 = mysql_fetch_array($rs29))
{
$num_rows29 = mysql_num_rows($rs29);
$num29 = $num_rows29;
$bee29 = $b;
}
}
$perfrm = number_format($per,3);
Print "<option value=$mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers> $mynum appears $cnt times or in $perfrm% of the $num29 drawings since $date :Hot Numbers</option>" ;
}
print "</select>";
print "</form>";
print "</div>"."<br>";
//*****************************
mysql_close();
?>