Hi there,

This my first post here and I am fairly new to coding so I apologize if I don't sound like I don't know what I'm doing and for the long post...

So I am currently working on an internship project that revolves around a database for a school. There is only one part that needs to be completed.

I have written a PHP script that allows the school to make changes to the database without needing to understand PHPmyAdmin or MySQL. The script runs off of two different pages, the first page allows the user to select which changes they want made using check boxes. After clicking the "Update Database" page it takes you to the second page which displays the results of what you did.

Behind the scenes, the "results" page is the php that actually edits the database. This all works on my machine. I gave it the school's IT team and they set it up to work on their servers, unfortunately they also changed the code that communicates with the database. The result: Every time I click "Update Database" on the first page, it loads only the shell of the results page.

I am fairly new to PHP/MySQL coding and my question is, what did they do and how do I make it work? I would ask their IT team but the guy that made the changes is going to be on vacation for a while and I would like to get this done fairly soon.

Here is the script from the "results page" that interacts with the database:

Code:
<?php 
 include("assign.inc");
 
 
 //require_once 'MySqlConnection.php';
  /*
 $server = 'localhost';
 $dataBase = 'ise_programs';
 $userName = 'root';
 $password = '';
 
 $mySqlConnection = new MySqlConnection($server, 
             $dataBase, 
             $userName, 
             $password);


 $townName = $_POST["townName"];
 //$townName = addslashes($townName); //To pevent SQL Injection, but make sure magic quotes are off

 $townidQuery = "SELECT townid 
     FROM tbltowns 
     WHERE townname = '$townName'";

 $townidArray = $mySqlConnection->doQuery($townidQuery);
 $townid = $townidArray[0][0]; 
 */  
 
 $townName = $_POST["townName"]; 
 $query = "SELECT townid FROM tbltowns WHERE townname = '" . addslashes($townName) . "'"; 
 $town_result = $db->query($query); 
 
 $townid = $town_result->result();

 //grab values the user selected in the form
if(isset($_POST["ICLEI"])){
$iclei = $_POST["ICLEI"];
 }
if(isset($_POST["CCEF"])){
 $ccef = $_POST["CCEF"];
 }
if(isset($_POST["ISE"])){
 $ise = $_POST["ISE"];
 }
if(isset($_POST["CEEF"])){
 $ceef = $_POST["CEEF"];
 }
if(isset($_POST["EPACC"])){
 $epacc = $_POST["EPACC"];
 }
if(isset($_POST["K12ISE"])){
 $k12ise = $_POST["K12ISE"];
 }
if(isset($_POST["KCTC"])){
 $kctc = $_POST["KCTC"];
 }
if(isset($_POST["MBBPM"])){
 $mbbpm = $_POST["MBBPM"];
 }
if(isset($_POST["N2N"])){
 $n2n = $_POST["N2N"];
 }
if(isset($_POST["SBPM"])){
 $sbpm = $_POST["SBPM"];
 }
 
?>

<html>
 <head>
  <style>
    body {
      color: #5A5A5A;
      background-color: #cae6b8;
      font-family: Arial,Helvetica,sans-serif;
      font-size: 13px;
      text-align: center;
    }
    li {
     list-style-type: none;
    }
    ul {
     padding-left: 0;
     line-height: 1.5em;
    }
    #wrapper {
     width: 400px;
     background-color: white;
     margin: 0 auto;
     padding: 1em;
     border-radius: 5px;
     box-shadow: 2px 2px 5px black;
    }
  </style>
 </head>
 <body>
 
 <div id="wrapper">
 
 <h1>Results for <?php echo($townName) ?></h1>
  
 <?php
 /*
 $enabledProjectsListQuery = "SELECT projectid
 FROM tblenabledprojects
 WHERE townid = $townid";

 $enabledProjectsList = $mySqlConnection->doQuery($enabledProjectsListQuery);
 */  
     
 $query = "SELECT projectid FROM tblenabledprojects WHERE townid = '" . addslashes($townid) . "'"; 
 $project_result = $db->query($query); 
 //convert enabled projects list into an array of single values
 $enabledProjects = array();
 //for($i = 0; $i < count($enabledProjectsList); $i++){
  //$enabledProjects[] = $enabledProjectsList[$i][0];
 //} 
 while($project = $project_result->fetch()) {  
  $enabledProjects[] = $project->townid; 
 } // end while
      
 //determine whether values were enabled in the database
 for($i = 1; $i < 11; $i++){
   if(in_array($i, $enabledProjects)){
    switch($i){
    case 1: 
     $icleiDB = true;
    break;
    case 2: 
     $ccefDB = true;
    break;
    case 3: 
     $iseDB = true;
    break;
    case 4: 
     $ceefDB = true;
    break;
    case 5: 
     $epaccDB = true;
    break;
    case 6: 
     $k12iseDB = true;
    break;
    case 7: 
     $kctcDB = true;
    break;
    case 8: 
     $mbbpmDB = true;
    break;
    case 9: 
     $n2nDB = true;
    break;
    case 10: 
     $sbpmDB = true;
    break;
    default: echo('Something went wrong at line 119.');
   }
  }
  else{
    switch($i){
     case 1: 
      $icleiDB = false;
     break;
     case 2: 
      $ccefDB = false;
     break;
     case 3: 
      $iseDB = false;
     break;
     case 4: 
      $ceefDB = false;
     break;
     case 5: 
      $epaccDB = false;
     break;
     case 6: 
      $k12iseDB = false;
     break;
     case 7: 
      $kctcDB = false;
     break;
     case 8: 
      $mbbpmDB = false;
     break;
     case 9: 
      $n2nDB = false;
     break;
     case 10: 
      $sbpmDB = false;
     break;
     default: echo('Something went wrong at line 154.');
   }
  }
 }

 //compare selections with DB values and decide what needs to change
 function updateDB($projectName, $program, $programDB, $projectid, $mySqlConnection, $townid){
   if(!$program && $programDB){ 
    //user says program = false, DB says true. delete from DB
    //$addToDB = "DELETE FROM tblenabledprojects WHERE townid = '$townid' AND projectid = '$projectid'";
    //$mySqlConnection->doNonQuery($addToDB);        
    $query = "DELETE FROM tblenabledprojects WHERE townid = '$townid' AND projectid = '$projectid'";    
    $db->query($query);
    return $projectName . " is <strong>no longer completed</strong>.<br>";
   }
   else if($program && !$programDB){ //user says program = true, DB says false. add to DB    
    /*
    $addToDB = "INSERT INTO tblenabledprojects 
       VALUES ($townid, $projectid)";
    $mySqlConnection->doNonQuery($addToDB);    */    
    $query = "INSERT INTO tblenabledprojects VALUES ($townid, $projectid)";    
    $db->query($query);
    return $projectName . " has now been <strong>completed</strong>.<br>";
   }
   else{
    if($program){
     return $projectName . " remains <strong>completed</strong>.<br>";
    }
    elseif(!$program){
     return $projectName . " remains <strong>incomplete</strong>.<br>";
    }
    else{
     return 'Something went wrong.';
    }
 
   }
 }
 
 ?>
 
 <ul>
 <li><?php echo(updateDB("Cities for Climate Protection (ICLEI)", $iclei, $icleiDB, 1, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("CT Clean Energy (CCEF)", $ccef, $ccefDB, 2, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("CT Energy Education (ISE)", $ise, $iseDB, 3, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("eeCommunities (CEEF)", $ceef, $ceefDB, 4, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("EPA Community Challenge", $epacc, $epaccDB, 5, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("K-12 School Energy Training (ISE)", $k12ise, $k12iseDB, 6, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("Keep CT Cool (ISE)", $kctc, $kctcDB, 7, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("Municipal Buildings Benchmarked with Portfolio Manager (ISE)", $mbbpm, $mbbpmDB, 8, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("Neighbor to Neighbor", $n2n, $n2nDB, 9, $mySqlConnection, $townid)); ?></li>
 <li><?php echo(updateDB("School Benchmarked with Portfolio Manager (ISE)", $sbpm, $sbpmDB, 10, $mySqlConnection, $townid)); ?></li>
 </ul>

 </div> <!-- end #wrapper -->
 </body>
</html>
Originally, I used a "mySqlConnection" file that holds all the connection information for my database, but that is only for my computer and doesn't translate to the school's servers. It looks like this part was commented and the IT team inserted their own code, which obviously breaks any connections that I had.

Any help would be greatly appreciated and if any additional information is needed I will post it.