How to search user login to search data in database?

0

Good night guys, I'm using this command line, it worked fine with me typing the person's login, but when I try to go based on 'user_login' the page does not even load when I try, I already tried to use it here:

$current_user = wp_get_current_user();

$user_info = get_userdata($current_user->ID);

$username = $user_info->user_login;

But it did not help, could you help me? follow the code of the page:

?php

$host = "xxxx";
$db   = "xxx";
$user = "zzz";
$pass = "sddss";

$con = mysqli_pconnect($host, $user, $pass) or trigger_error(mysqli_error(),E_USER_ERROR); 

mysqli_select_db($db, $con);

$query = sprintf("SELECT valor FROM investimentos WHERE login= 'mirthrandir' ");

$dados = mysqli_query($query, $con) or die(mysqli_error());

$linha = mysqli_fetch_assoc($dados);

$total = mysqli_num_rows($dados);

?>


    
    Teste


?php
    // se o número de resultados for maior que zero, mostra os dados
    if($total > 0) {
        // inicia o loop que vai mostrar todos os dados
        do {
?>
            

?=$linha['valor']?> /

?php // finaliza o loop que vai mostrar os dados }while($linha = mysqli_fetch_assoc($dados)); // fim do if } ?>
    
asked by anonymous 23.04.2018 / 00:52

0 answers