<?php


$servername = "127.0.0.1";
$username = "root";
$password = "";
$database = "trabajoolas5";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully\n";

$allrubrics = mysqli_query($conn, 'select id, num_scales, max_score from `rubrics`');

while ($row = mysqli_fetch_array($allrubrics)) {

if($row['num_scales']==0 && $row['max_score']==0){
    $query = "update rubrics set num_scales = 4, max_score =8 where id ={$row['id']} ";
    $makeQuery = mysqli_query($conn, $query);
    if(!$query){
        die("Connection failed: " . mysqli_error($conn) . $query1);
    }

}

}

$allrubrics = mysqli_query($conn, 'select id, num_scales, max_score from `templates`');

while ($row = mysqli_fetch_array($allrubrics)) {

if($row['num_scales']==0 && $row['max_score']==0){
    $query = "update templates set num_scales = 4, max_score =8 where id ={$row['id']} ";
    $makeQuery = mysqli_query($conn, $query);
    if(!$query){
        die("Connection failed: " . mysqli_error($conn) . $query1);
    }

}

}
