Autor Zpráva
pepan
Profil
Ahoj mám tento script :
<?php
////////////////////////////////////////////////////////////////////// //////////////////
// Class: DbConnector
// Purpose: Connect to a database, MySQL version
////////////////////////////////////////////////////////////////////// /////////////////
require_once 'systemcomponent.php';

class DbConnector extends SystemComponent {

    var $theQuery;
    var $link;

    //*** Function: DbConnector, Purpose: Connect to the database ***
    function DbConnector(){

        // Load settings from parent class
        $settings = SystemComponent::getSettings();

        // Get the main settings from the array we just loaded
        $host = $settings['dbhost'];
        $db = $settings['dbname'];
        $user = $settings['dbusername'];
        $pass = $settings['dbpassword'];

        // Connect to the database
        $this->link = mysql_connect($host, $user, $pass);
        mysql_select_db($db);
        register_shutdown_function(array(&$this, 'close'));

    }

    //*** Function: query, Purpose: Execute a database query ***
    function query($query) {

        $this->theQuery = $query;
        return mysql_query($query, $this->link);

    }

    //*** Function: fetchArray, Purpose: Get array of query results ***
    function fetchArray($result) {

        return mysql_fetch_array($result);

    }

    //*** Function: close, Purpose: Close the connection ***
    function close() {

        mysql_close($this->link);

    }


}
?>

a vypisuje mi to tuto chybu : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\xampp\web\ssko\DbConnector.php on line 43
(řádek 43 je zvýrazněn tučně)
Ještě přikládám soubor systemcomponent.php
<?php
class SystemComponent {

    var $settings;

    function getSettings() {

        // System variables
        $settings['siteDir'] = 'http://localhost/xampp/web/ssko/';

        // Database variables
        $settings['dbhost'] = 'localhost';
        $settings['dbusername'] = 'root';
        $settings['dbpassword'] = '';
        $settings['dbname'] = 'ssko';

        return $settings;

    }

}
?>

Nevíte kde by tam mohla být chyba? Děkuji
el mariachi
Profil
no ale toto moc skripty nemáš, to sú len dve classy na prácu s mysql... kde máš kód na kde to aplikuješ ? to je tak, keď človek sťahuje skripty a nevie, na čo sú...

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