30.cache.php 941 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php return '$con = mysqli_connect("localhost", "root", "R3M0T31", "cropmonitor");
  2. // Check connection
  3. if (mysqli_connect_errno())
  4. {
  5. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  6. }
  7. $result = mysqli_query($con, "SELECT * FROM `plant_specifications`");
  8. // mysqli_query returns false if something went wrong with the query
  9. if ($result === FALSE)
  10. {
  11. die(mysqli_error($con)); // TODO: better error handling
  12. }
  13. else
  14. {
  15. ?>
  16. <div class="col-md-4 form-group">
  17. <small id="lab_no" class="form-text text-muted">Crop Type <span class="error">*</span></small>
  18. <div><select class="form-control form-control-sm" name="crop_type" id="crop_type" required>
  19. <option>Select the type of Crop...</option>
  20. <?php
  21. while ($row = mysqli_fetch_array($result))
  22. {
  23. echo "<option id=" . $row[\'id\'] . ">" . $row[\'plant_type\'] . "</option>";
  24. }
  25. ?>
  26. </select></div>
  27. </div>
  28. <?php
  29. }
  30. mysqli_close($con);
  31. return;
  32. ';