What is the best way to display information about a specific user from the database? For example, his login, password, date of birth.

fetchrow`ом 

Or are there analogues of this "operation"?

    2 answers 2

    PDO is best to use:

     public static function LoadFromTable($id){ $DBH = Registry::get('DBH'); $STH = $DBH ->prepare("SELECT * FROM users WHERE id = :id"); // забираем информацию о юзере по id $STH->bindParam(':id', $id, PDO::PARAM_STR); // или PARAM_INT $STH->execute(); $result = $STH->fetchAll(); return $result; // вернет ассоциативный массив } 

    For more details look at my answer here , well, do not forget about the office. php.net PDO documentation.

    • Before copying the answer, see if you stole it correctly. Nobody said that this would be an object method (although it should be), and it is also unclear what Registry::get('DBH') (although you can guess). - user31688
    • o_O where did you steal it? - barseon

    Shta
    Choose with select , pick up from the response object via fetch - if through PDO.