mardi 28 juillet 2015

PHP + ADODB do nonthink

Hi everyone i try write page with PHP and ADODB db-engine is mysql. I want to add to mysql new record and show table. Someone knows what is wrong with that code?

index.php

    <?php 
    require('./engine.php');
    $lz = new zakupy;
    $lz->pokaz();
    ?>

engine.php

 <?php 
include('adodb/adodb.inc.php');

class zakupy {

    function __construct($dbuser,$dbpass,$dbname,$dbhost)
        { 
            $db = ADONewConnection('mysql');
            $db->debug = true;
            $this-> $db->Connect($dbhost,$dbuser,$dbpass,$dbname);
        }

    function dodaj($name)
        {
            $rs = $db->Execute('insert into zakupy values(null,\''.$name.'\',\'N\');');
        }

    function pokaz(): void
    {
        $rs = $db->Execute('select * from zakupy');
        print "<pre>";
        print_r($rs->GetRows());
        print "</pre>";
    }
    }

?>




Aucun commentaire:

Enregistrer un commentaire