Nenhuma descrição

script_template_fix.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. $servername = "127.0.0.1";
  3. $username = "root";
  4. $password = "";
  5. $database = "trabajoolas5";
  6. // Create connection
  7. $conn = mysqli_connect($servername, $username, $password, $database);
  8. // Check connection
  9. if (!$conn) {
  10. die("Connection failed: " . mysqli_connect_error());
  11. }
  12. echo "Connected successfully\n";
  13. $allrubrics = mysqli_query($conn, 'select id, num_scales, max_score from `rubrics`');
  14. while ($row = mysqli_fetch_array($allrubrics)) {
  15. if($row['num_scales']==0 && $row['max_score']==0){
  16. $query = "update rubrics set num_scales = 4, max_score =8 where id ={$row['id']} ";
  17. $makeQuery = mysqli_query($conn, $query);
  18. if(!$query){
  19. die("Connection failed: " . mysqli_error($conn) . $query1);
  20. }
  21. }
  22. }
  23. $allrubrics = mysqli_query($conn, 'select id, num_scales, max_score from `templates`');
  24. while ($row = mysqli_fetch_array($allrubrics)) {
  25. if($row['num_scales']==0 && $row['max_score']==0){
  26. $query = "update templates set num_scales = 4, max_score =8 where id ={$row['id']} ";
  27. $makeQuery = mysqli_query($conn, $query);
  28. if(!$query){
  29. die("Connection failed: " . mysqli_error($conn) . $query1);
  30. }
  31. }
  32. }