Bojak Posted March 14, 2014 Share Posted March 14, 2014 <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php class DB { 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 DB(); } } } return self:$_instance; ?> </body> </html> getting errors on line 32, 34, 41 and i dont understand why. maybe ive missed a bracket but i have checked them a few times. any suggestions? thanks! oh, i have more files since i am trying to make it PDO but i thought you would only want to see the file in which the error occured. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 14, 2014 Share Posted March 14, 2014 Why didn't you show us the error messages? Quote Link to comment Share on other sites More sharing options...
Bojak Posted March 14, 2014 Author Share Posted March 14, 2014 because i dont have it on a localhost at the moment. i just saw the error in dreamweaver and i cant figure it out. Quote Link to comment Share on other sites More sharing options...
Bojak Posted March 14, 2014 Author Share Posted March 14, 2014 ( ! ) Fatal error: require_once(): Failed opening required 'classes/Sanitize.php' (include_path='.;C:\php\pear') in C:\wamp\www\loginsystem\Core\Init.php on line 38 ( ! ) Warning: require_once(classes/Sanitize.php): failed to open stream: No such file or directory in C:\wamp\www\loginsystem\Core\Init.php on line 38 i get that from my localhost Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 14, 2014 Share Posted March 14, 2014 WHAT is the error? You expect us to guess what it is? And which lines are those numbers? Suggestion? Define your class outside of your html. It will make it easier to read and debug Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 14, 2014 Share Posted March 14, 2014 So - now you know what your problem is. Can't find a script that you want to include Quote Link to comment Share on other sites More sharing options...
Bojak Posted March 14, 2014 Author Share Posted March 14, 2014 i fixed the missing file issue. although dreamweaver still says i have errors on on line 32, 34, 41 in the DB.php file and i posted the code above. Quote Link to comment Share on other sites More sharing options...
Bojak Posted March 14, 2014 Author Share Posted March 14, 2014 i havent used any html. im currently following a tutorial. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 14, 2014 Share Posted March 14, 2014 Your php code is buried in the middle of html. Quote Link to comment Share on other sites More sharing options...
Bojak Posted March 14, 2014 Author Share Posted March 14, 2014 ah so just remove the tags? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 14, 2014 Share Posted March 14, 2014 Did your tutorial tell you to put them there? Interesting that you are following a beginner's(?) PHP tutorial and it starts out with you creating a class (for an un-necessary purpose btw) and you don't even know html yet. Quote Link to comment Share on other sites More sharing options...
Bojak Posted March 14, 2014 Author Share Posted March 14, 2014 dont assume i dont know html. i do know html. this is a beginners tutorial for PDO and OOP. after taking out the html tags the index.php is blank when looking at it in a web browser. but dream weaver says i have errors on 24, 26, 33. blame dreamweaver for not being specific enough. <?php class DB { 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 DB(); } } } return self:$_instance; ?> Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 14, 2014 Share Posted March 14, 2014 Sorry - can't help you. Good luck. Quote Link to comment Share on other sites More sharing options...
Bojak Posted March 14, 2014 Author Share Posted March 14, 2014 i figured out line 33 issue. trying to figure out 24 and 26. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.