I have a non-profit Christian school site that asked me to create a custom CMS so they could update the main parts of their site in-house. I'm a front-end developer, but wanted to learn more PHP, so I created the CMS and the site to read the database as needed. Through assistance from this forum, I was able to get it working correctly on my computer's MAMP server.

Unfortunately, when I moved it to the live server, more errors came up. Two scripts are coming up with undefined variables, but despite multiple checks, I can't see the error. The variables are defined and work on MAMP, just not the live server. I have asked for assistance here, but it seems to no avail.

As school is starting in a few weeks for them, this project needs to be fully functioning. After completely volunteering my time and spending four months working on it through other work, I'm tired of it. I need either assistance in finding the problem or another developer that's willing to step in and work on it.

Ideally, it needs to be done by August 9, but earlier is better. The offending scripts are listed below, but anyone willing to offer help is appreciated. The DbFactory was totally new to me, which wouldn't take much, but since I had everything working, I don't believe it's the problem.

DbFactory.php
PHP Code:
<?php 
class DbFactory{
  private static 
$factory;
  public static function 
getFactory(){
      if (!
self::$factory){
        
self::$factory = new DbFactory();
        return 
self::$factory;
      } else {
        throw new 
exception('DbFactory could not return database instance.');
      }
  }
  private 
$db;
  public function 
getConnection(){
      if (!
$db)
           
$db = new PDO("mysql:host=216.51.232.202;dbname=name""user""pass");
      return 
$db;
  }
}
?>

getschedule.php
PHP Code:
<?php
$o_Db 
DbFactory::getFactory()->getConnection();

function 
GetSchedule(PDO $o_Db$table_name$fields){
  if(!
$o_Db || !$table_name || !fields){
    throw new 
exception('GetData(PDO $o_Db, string $table_name, array or string $fields. You did not pass one of the variables');
  }
  if(
is_array($fields)){
    
$fields_count count($fields);
    
$i 1;
    
$sql_fields null;
    foreach(
$fields as $value){
      if(
$i $fields_count){
        
$sql_fields .= "$value, ";
      } else {
        
$sql_fields .= "$value";
      }
      
$i++;
    }
  } else {
    
$sql_fields htmlentities($fields);
  }
  
$table_name htmlentities($table_name);

  
$sql "SELECT datetext FROM schedule";
  
$stmt $o_Db->prepare($sql);
  
$stmt->execute();
  return 
$stmt->fetchAll(PDO::FETCH_ASSOC); 
  }
?>