Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddri

Status
Niet open voor verdere reacties.

bonkel007

Gebruiker
Lid geworden
5 mei 2011
Berichten
77
Oke de errors:

Notice: Use of undefined constant DB_TYPE - assumed 'DB_TYPE' in C:\xampp\htdocs\GameEngine\Database.php on line 13

Notice: Use of undefined constant SQL_SERVER - assumed 'SQL_SERVER' in C:\xampp\htdocs\GameEngine\Database\db_MYSQL.php on line 17

Notice: Use of undefined constant SQL_USER - assumed 'SQL_USER' in C:\xampp\htdocs\GameEngine\Database\db_MYSQL.php on line 17

Notice: Use of undefined constant SQL_PASS - assumed 'SQL_PASS' in C:\xampp\htdocs\GameEngine\Database\db_MYSQL.php on line 17

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: Host is onbekend. in C:\xampp\htdocs\GameEngine\Database\db_MYSQL.php on line 17

Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: getaddrinfo failed: Host is onbekend. (trying to connect via tcp://SQL_SERVER:3306) in C:\xampp\htdocs\GameEngine\Database\db_MYSQL.php on line 17

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: getaddrinfo failed: Host is onbekend. in C:\xampp\htdocs\GameEngine\Database\db_MYSQL.php on line 17
php_network_getaddresses: getaddrinfo failed: Host is onbekend.

De script database.php:
PHP:
<?php

include("config.php");

switch(DB_TYPE) {
	case 1:
	include("Database/db_MYSQLi.php");
	break;
	//case 2:
	//include("Database/db_MSSQL.php");
	//break;
	default:
	include("Database/db_MYSQL.php");
	break;
}
?>
De script db_MYSQL.php (regel 1 t/m 30 is een vrij groot script):
PHP:
<?php

        class MYSQL_DB {

        	var $connection;
        	function MYSQL_DB() {
        		$this->connection = mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS) or die(mysql_error());
        		mysql_select_db(SQL_DB, $this->connection) or die(mysql_error());
        	}

        	function register($username, $password, $email, $tribe, $locate, $act) {
        		$time = time();
        		$timep = (time() + PROTECTION);
        		$q = "INSERT INTO " . TB_PREFIX . "users (username,password,access,email,timestamp,tribe,location,act,protect) VALUES ('$username', '$password', " . USER . ", '$email', $time, $tribe, $locate, '$act', $timep)";
        		if(mysql_query($q, $this->connection)) {
        			return mysql_insert_id($this->connection);
        		} else {
        			return false;
        		}
        	}

        	function activate($username, $password, $email, $tribe, $locate, $act, $act2) {
        		$time = time();
        		$q = "INSERT INTO " . TB_PREFIX . "activate (username,password,access,email,tribe,timestamp,location,act,act2) VALUES ('$username', '$password', " . USER . ", '$email', $tribe, $time, $locate, '$act', '$act2')";
        		if(mysql_query($q, $this->connection)) {
        			return mysql_insert_id($this->connection);
        		} else {
        			return false;
        		}
        	}
 
Laatst bewerkt door een moderator:
PHP:
<?php
 
include("config.php");
 
switch(DB_TYPE) {//deze constante is niet gedeclareert zie global en dit is voor de ander eveneens
    case 1:
    include("Database/db_MYSQLi.php");
    break;
    //case 2:
    //include("Database/db_MSSQL.php");
    //break;
    default:
    include("Database/db_MYSQL.php");
    break;
}
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan