Advertisement
Guest User

Untitled

a guest
Apr 15th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. require_once 'include/class.Settings.php';
  2.  
  3. class MonthlySums{
  4. protected static $dbh;
  5. public function __construct() {
  6. $user = Settings::$db['user'];
  7. $pass = Settings::$db['password'];
  8. $dsn = 'mysql:host=' . Settings::$db['host'] . ';dbname=' . Settings::$db['db'];
  9.  
  10. try {
  11. self::$dbh = new PDO($dsn, $user, $pass);
  12. } catch(PDOException $e) {
  13. die("Error! : " . $e->getMessage());
  14. }
  15.  
  16. }
  17. public static function get($init_id) {
  18. $sql = "SELECT `year`, `month`, `gains_monthly_sum` FROM `fxs_gain_sums` WHERE `init_id` = '$init_id'";
  19. $resultats = MonthlySums::$dbh->query($sql);
  20. var_dump($resultats);
  21. }
  22.  
  23. }
  24.  
  25. Fatal error: Call to a member function query() on a non-object in /home/fxscript/public_html/gainlosssums.php on line 45
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement