Side loader langsomt
Internet Explorer loader denne side meget langsomt, faktisk begynder IE ikke at svare.. er der nogen der kan sige hvorfor...ether_price er en tabel med 2 rækker...
<?php
// Open database
$db=mysql_connect("localhost", "username", "password");
if (!$db) { die("Could not connect: " . mysql_error()); }
mysql_select_db("database", $db);
// SELET ALL PRICES
$result = mysql_query("SELECT * FROM ether_price ORDER BY date") or die(mysql_error());
// keeps getting the next row until there are no more to get (AND PUT IN ARRAY'S)
$i=0;
while($row = mysql_fetch_array( $result )) {
//Count number of dates;
$i=$i+1;
//Assign mysql data to arrays
$id[$i]=$row['id'];
$dates[$i]=$row['date'];
$alm[$i]=$row['alm'];
$guld[$i]=$row['guld'];
$special[$i]=$row['special'];
$shot[$i]=$row['shot'];
$drink[$i]=$row['drink'];
$soda1[$i]=$row['soda1'];
$soda2[$i]=$row['soda2'];
$toast[$i]=$row['toast'];
$tilbud[$i]=$row['tilbud'];
$udbetal[$i]=$row['udbetal'];
$indbetal[$i]=$row['indbetal'];
}
//Set number of dates:
$NumerOfDates=$i;
//Close Database
mysql_close();
//Write list of dates
for ( $i = 1; $x <= $NumerOfDates; $i = $i+1) {echo $dates[$x]."<br>";}
// Find pricedate if not exact get the date before
$TargetDate=$_GET['date'];
if ($TargetDate<>"") {
//Reset specific date, (returns first value if no date found)
$DateIsNumber=0;
//Write Target date
echo "target.dato: ".$TargetDate."<br>";
// Find date date that is larger than the value (first date first)
for ( $i = 1; $i <= $NumerOfDates; $i = $i+1) {
if ($TargetDate>=$dates[$i]) {$DateIsNumber=$i;}
}
// if no date is found set date as first date
if ($DateIsNumber==0) {$DateIsNumber=1;}
echo "pris.dato: ".$dates[$DateIsNumber]."<br>";
}
?>