FIXED: The problem was the spl_autoloader dosent work on the webserver for some reason and there was one typeo in my code that worked on my machine but not the webserver.
Trying to solve a problem on my website where it works on my machine but not the Google hosted VM.
The database can receive data but i cant seem to get it to display data through JSON POST requests or login through the login system.
I have a feeling the database is not "sending" data to PDO.
Is there a log or something i can do to check requests to the database?
System info: http://www.interplanetaryhub.com/phpinfo.php
Database connecting code thats works on my machine but not the webhost VM
<?php
class Database {
private static $_instance = null;
private $_pdo,
$_query,
$_error = false,
$_results,
$_count = 0;
private function __construct() {
try {
$this->_pdo = new PDO('mysql:host='.Config::get('mysql/host').';dbname='.Config::get('mysql/db'),Config::get('mysql/username'),Config::get('mysql/password'));
} catch (PDOException $e) {
die($e->getMessage());
}
}
public static function getInstance() {
if (!isset(self::$_instance)) {
self::$_instance = new Database();
}
return self::$_instance;
}
public function query($sql, $params = array()) {
$this->_error = false;
if ($this->_query = $this->_pdo->prepare($sql)) {
$x = 1;
if (count($params)) {
foreach ($params as $param) {
$this->_query->bindValue($x, $param);
$x++;
}
}
if ($this->_query->execute()) {
$this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
$this->_count = $this->_query->rowCount();
} else {
$this->_error = true;
}
}
return $this;
}