Hello please i need some help to rewrite this code in PHP to Python i am totally new in this and need this baddly please help if u can. Thanks a lot.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>phpChart - Basic Chart</title>
</head>
<body>
<?php
function array_delete($array, $element) {
return array_diff($array, $element);
}
$firs_constant = 0.005;
$secound_constant = 0.005;
$rozdielne[1000] = 0;
$link = mysqli_connect('127.0.0.1', 'webmaster', 'noerroronweb',"smart_meter");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$result = mysqli_query($link,"SELECT date, current3 FROM `current` ORDER BY `current`.`date` ASC");
$values = array();
$i=0;
echo "<br>";
$y=0;
while($row[$i++] = mysqli_fetch_array($result))
{
if($row[$i-1]['current3'] == "0") $row[$i--];
}
for($z=0;$z<=$i; $z++){
$rozdiel = $row[$z]['current3'] - $row[$z+1]['current3'] ;
if(abs($rozdiel)>=$firs_constant){
$rozdelove[$y] = abs($rozdiel);
$y++;
}
}
echo "<h1>Vypis rozelnych hodnot</h1><br>";
$p=0;
for($z=0;$z<=$y; $z++){
$je=false;
for($m=$z-1;$m>=0; $m--){
$min = $rozdelove[$m]- $secound_constant;
$max = $rozdelove[$m]+ $secound_constant;
if($rozdelove[$z]<= $max && $rozdelove[$z]>= $min )
$je=true;
}
if($je == false ){
$je=false;
array_push($rozdielne,$z);
$p++;
}
}
for($m=0;$m<count($rozdelove);$m++){
for($k=0;$k<count($rozdelove);$k++){
if ($m!=$k){
$sucet = $rozdelove[$k] + $rozdelove[$m];
foreach ($rozdielne as &$value) {
if($sucet == $rozdelove[$value]){
echo "Toto je sucet: ".$rozdelove[$value]."<br>";
echo "Pre hodnoty: ".$rozdelove[$k]."a ". $rozdelove[$m] ."<br>";
}
}
}
}
}
echo "<pre>";
var_dump($rozdielne);
echo "</pre>";
?>
</body>
</html>