php - Call to undefined method on calling DB Class -
i've been struggling little while code should take care of (is not mine 1 of biggest issues). original programmer unresponsive , unwilling help; improve situation further.
the code page content shown, e-catalog. flow of items @ bottom consists of 10 items, fatal error on calling php database information:
fatal error: call undefined method db::connection() in c:\xampp\htdocs\menonitapp2\api\modelos\productos.php on line 128
the error occurs here:
require_once "db.php"; //the db info file. require_once "producto.php"; require_once "subasta.php"; class productos { private function __construct() { //actually empty constructor. } //other functions public static function buscar_primeros($id, $bus, $counting){ $min = $counting; $max = 10; $statement = db::connection()->stmt_init(); //where error occurs //more stuff after } }
and full db.php file access database:
class db { private static $servername = "localhost"; private static $username = "root"; private static $password = "********"; private static $dbname = "taquionm_menonitapp"; private static $connexion = null; static function connection() { if(is_null(self::$connexion)) { self::$connexion = new mysqli(self::$server, self::$username, self::$password, self::$dbname); self::$connexion->set_charset("utf8"); if (mysqli_connect_errno()) { printf("connect failed: %s\n", mysqli_connect_error()); exit(); } } return self::$connexion; } }
other relevant information: using xampp 5.6.8
on windows 8.1. php version 5.6.8
well.
Comments
Post a Comment