Autor Zpráva
Ten co si neví rady
Profil *
V index.php mám

    # Pristupové udaje k databazi

$MySQL_server = "localhost"; // MySQL server
$MySQL_user = "root"; // jmeo uživatele
$MySQL_password = ""; // přistupove heslo
$MySQL_database = "btrida"; // nazev databaze

require( 'etc/db-layer.php' );

# Pripojeni k databazi
$db->query('SET NAMES utf8');
@mysql_select_db($MySQL_database);

mysql_query("SET CHARACTER SET utf8"); // prevedeni znakove sady

# Povedlo se pripojit k databazi?
if ( !$db->spojeni )
{
echo require 'etc/error/mysql.php';
exit;
}

if ( !$db->spojeno )
{
echo '<p>MySQL server byl pripojen (spravne prihlasovaci udaje), ale <b>nebyla nalezena databaze</b> se zadanym jmenem. Patrne chybny udaj.</p>';
exit;
}


a v etc/db-layer.php

	class DB

{
# Vnitrni promenne
var $spojeni;
var $spojeno;

# DB > Kostruktor
function DB ( $MySQL_server,$MySQL_user,$MySQL_password,$MySQL_database )
{
$this->server = $MySQL_server;
$this->database = $MySQL_database;
$this->user = $MySQL_user;
$this->password = $MySQL_password;
$this->spojeni = @mysql_connect($this->server, $this->user, $this->password);
$this->spojeno = mysql_select_db($this->db);

}
###

# close > Kostruktor
function close ( $MySQL_server,$MySQL_user,$MySQL_password,$MySQL_database )
{
@mysql_close($this->spojeni);
}
###

}
###


a vždy to vypíše chybu
Warning: main(etc/db-layer.php): failed to open stream: No such file or directory in c:webwww!worktrida.wz.cz\_config.php on line 27


Fatal error: main(): Failed opening required 'etc/db-layer.php' (include_path='.;C:/webphppear') in c:webwww!worktrida.wz.cz\_config.php on line 27


Moc prosím o radu...
qwertz
Profil
Ten co si neví rady
nikde ale nevidim ze by si vytvoril instanci tridy DB($obj = new DB();)
EDIT: nebylo by lepsi prejit k PHP5 a mysqli kdyz chces psat objekty?

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0