Looking for a simple example of the mySQLi class with descriptions

I am looking for an example of a simple but functional example of a class extending the mySQLi class in PHP5. I am also interested in stored procedures. Basically, I need an example of a practical and useful class. I learned the best example and, unfortunately, I could not find any website or book that seems to have a really solid, but simple example. All the examples that I see are complex, so I can’t understand, or are they so simple that I could just instantiate the class right then and there inside. It would be great if someone could provide me with an example like this and explain what happens, no matter how good they are. My long-term goal is to have a class that I can create that deals with database authentication,and then takes my SQL statements and supplies the output to variables.

If someone wants to spend time to help me, it will be very appreciated! thanks

+3
source share
5 answers

Have you checked PHP PEAR MDB2? http://pear.php.net/package/MDB2

Its not that simple, its the best DAL in php IMHO ...

+1
source

About mysqli, you can take a look at these articles:

(Pretty old, but the mysqli extension hasn't changed that much for a couple of years, so everything should be fine)

PDO, PHP 5.1; - API ( mysqli_query, pg_query, oci8_query , $pdo- > query - , SQL , ;()

ORM, , Doctrine.

, MySQLi, - , "-SQL" ; ( ) - API, SQL.

, - ( , , )

+1
+1

, MySQLi? PDO , defacto PHP. PDO , , .

0

mysqli.

, "MyTimer", iTimer. iTimer, , $( microtime() getrusage() - ).

<?php
interface iTimer
{
    public function start($key);
    public function stop($key);
}

class mysqlp extends mysqli
{
    function query($query, $resultmode)
    {
        $timer = MyTimer::getInstance();
        $timer->start('mysqli::query');
        $result = parent::query($query, $resultmode);
        $timer->stop('mysqli::query');
        return $result;
    }
}

#usage
$mysqli = new mysqlp("localhost", "my_user", "my_password", "world");
$results = $mysqli->query("SELECT id FROM foo");
0

Source: https://habr.com/ru/post/1712833/


All Articles