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.

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>phpChart - Basic Chart</title>


function array_delete($array, $element) {
    return array_diff($array, $element);
$firs_constant = 0.005;
$secound_constant = 0.005;
$rozdielne[1000] = 0;

$link = mysqli_connect('', '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();
echo "<br>";

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'] ;

  $rozdelove[$y] = abs($rozdiel);

  echo "<h1>Vypis rozelnych hodnot</h1><br>";
  for($z=0;$z<=$y; $z++){

  for($m=$z-1;$m>=0; $m--){
  $min = $rozdelove[$m]- $secound_constant;
  $max = $rozdelove[$m]+ $secound_constant;

  if($rozdelove[$z]<= $max && $rozdelove[$z]>= $min )

  if($je == false ){




      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>";
  echo "</pre>";



You can't write this directly in Python, use a web framework like flask with MySQL

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.