Jump to content

Recommended Posts

<!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.

( ! ) 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

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.

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;
					
					



?>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.