webmastadj84
IS-IT--Management
Ok, here is the problem. This code works. The only part that is not working correctly is the bottom 5 lines. The loop works but it does not insert the information into the table and I get no error messages. Here is the full code; remember, everything works but the last 5 lines.
===============================================
$sqlGetNumbers = "SELECT * FROM `lotterynumbers`";
$conn = mysql_connect("localhost","**********","***********");
$result = mysql_query($sqlGetNumbers, $conn);
$LoopCount = 1;
while ($LoopCount < 54 ) {
$NumberTally[$LoopCount] = 0;
$LoopCount = $LoopCount + 1;
}
while ($newArray = mysql_fetch_array($result)) {
$date = $newArray['date'];
$n1 = $newArray['n1'];
$n2 = $newArray['n2'];
$n3 = $newArray['n3'];
$n4 = $newArray['n4'];
$n5 = $newArray['n5'];
$n6 = $newArray['n6'];
$NumberTally[$n1] = $NumberTally[$n1] + 1;
$NumberTally[$n2] = $NumberTally[$n2] + 1;
$NumberTally[$n3] = $NumberTally[$n3] + 1;
$NumberTally[$n4] = $NumberTally[$n4] + 1;
$NumberTally[$n5] = $NumberTally[$n5] + 1;
$NumberTally[$n6] = $NumberTally[$n6] + 1;
}
$LoopCount = 1;
while ($LoopCount < 54) {
$sqlUpdate = "INSERT INTO `lottostats` (`Number`,`Count`,Precent`,`Updated`) VALUES ('$LoopCount','$NumberTally[$LoopCount]','0.00','0')";
mysql_query($sqlUpdate, $conn);
echo "<tr><td>$LoopCount</td><td>$NumberTally[$LoopCount]</td></tr>";
$LoopCount = $LoopCount + 1;
}
===============================================
===============================================
$sqlGetNumbers = "SELECT * FROM `lotterynumbers`";
$conn = mysql_connect("localhost","**********","***********");
$result = mysql_query($sqlGetNumbers, $conn);
$LoopCount = 1;
while ($LoopCount < 54 ) {
$NumberTally[$LoopCount] = 0;
$LoopCount = $LoopCount + 1;
}
while ($newArray = mysql_fetch_array($result)) {
$date = $newArray['date'];
$n1 = $newArray['n1'];
$n2 = $newArray['n2'];
$n3 = $newArray['n3'];
$n4 = $newArray['n4'];
$n5 = $newArray['n5'];
$n6 = $newArray['n6'];
$NumberTally[$n1] = $NumberTally[$n1] + 1;
$NumberTally[$n2] = $NumberTally[$n2] + 1;
$NumberTally[$n3] = $NumberTally[$n3] + 1;
$NumberTally[$n4] = $NumberTally[$n4] + 1;
$NumberTally[$n5] = $NumberTally[$n5] + 1;
$NumberTally[$n6] = $NumberTally[$n6] + 1;
}
$LoopCount = 1;
while ($LoopCount < 54) {
$sqlUpdate = "INSERT INTO `lottostats` (`Number`,`Count`,Precent`,`Updated`) VALUES ('$LoopCount','$NumberTally[$LoopCount]','0.00','0')";
mysql_query($sqlUpdate, $conn);
echo "<tr><td>$LoopCount</td><td>$NumberTally[$LoopCount]</td></tr>";
$LoopCount = $LoopCount + 1;
}
===============================================