I'm trying to transfer a site from one hosting company to another. I was using 000webhost until the client had hosting and a domain. Now that the client has their domain and hosting, using FatCow.com, I can not for the life of me, debug my PHP code. I'm not getting any errors. I have a successful DB connection. If you procedurally display data, it works, but when I try to use my original objects, something is breaking and just returns "0:". I have all errors on.
On old server where the site worked:
PHP Version 5.2.11
MySQL Version: 5.0.81
On new server where I get the "0:":
PHP Version 5.2.12
MySQL Version 5.0.32
I've setup a test page to test just the output of the variables with the DB connection.
Below is my code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
try
{
$link = mysql_connect('connectionstring', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
else{
$db = mysql_select_db('a8210422_lit');
}
if($db){
include_once('admin/classes/clsPOW.php');
include_once('admin/classes/clsProviders.php');
$pow = new POW();
$prov = new Providers();
$new = $pow->getNew();
$newAr = $new->val();
$get = $prov->getAll($newAr['providerId']);
$getAr = $get->val();
$img = $getAr['image'];
$name = $getAr['provider'];
$desc = $getAr['description'];
$zip = $getAr['zip'];
$web = $getAr['link'];
if($zip==0){
$zip = "Unavailable";
}
print_r($getAr);
}
else{
print 'fail!';
}
}
//catch exception
catch(Exception $e)
{
echo 'Message: ' .$e->getMessage();
}
?>
//Class POW
require_once('clsSql.php');
require_once('clsResult.php');
include_once('/hermes/web07/b1323/moo.madisoncountyliterac/assets/includes/db.php');
class POW{
public function getNew(){
//instantiate the sql class
$SQL=new sql();
//Run a query - Result is automatically stored in the class
$sel = "SELECT providerId
FROM litProviders
WHERE image != ''
ORDER BY RAND()
LIMIT 1";
$q=$SQL->query($sel);
return $q;
}
}
//Class Providers
require_once('clsSql.php');
require_once('clsResult.php');
include_once('/hermes/web07/b1323/moo.madisoncountyliterac/assets/includes/db.php');
class Providers{
public function getAll($where=""){
if($where == ""){
$getAllQuery = "SELECT * FROM litProviders";
}
else{
$getAllQuery = "SELECT * FROM litProviders WHERE providerId = '".$where."'";
}
//instantiate the sql class
$SQL=new sql();
//Run a query - Result is automatically stored in the class
$q=$SQL->query($getAllQuery);
return $q;
}
public function submit($id="", $provider, $description, $zip, $image, $link){
if($id != ""){
//update
$query = "UPDATE litProviders SET provider = '".$provider."', description = '".$description."', zip = '".$zip."', image = '".$image."', link = '".$link."'
WHERE providerId = '".$id."' ";
$message = "The provider has been updated.";
}
else{
//insert
$newid = md5(uniqid());
$query = "INSERT INTO litProviders
VALUES ('".$newid."','".$provider."','".$description."','".$zip."','".$image."', '".$link."')";
$message = "You have added a new provider.";
}
//instantiate the sql class
$SQL=new sql();
//Run a query - Result is automatically stored in the class
$q=$SQL->query($query);
return $message;
}
public function delete($id=""){
if($id !=""){
$delQuery = "DELETE FROM litProviders WHERE providerId = '".$id."'";
//instantiate the sql class
$SQL=new sql();
//Run a query - Result is automatically stored in the class
$q=$SQL->query($delQuery);
if($q){
return true;
}
else{
return false;
}
}
else{
return "No ID was provided for deletion.";
}
}
}