0
Good evening, everyone, I am using this command line, it worked perfectly with me typing the login of the person, but when I try to put to go based on the 'user_login' (logged in user) it does not go to page or even load when I try, I tried to use up to this here:
$current_user = wp_get_current_user(); $user_info = get_userdata($current_user->ID); $username = $user_info->user_login;
But it didn’t work, could you help me? follows the page code:
?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
}
?>
I suggest that before solving this problem switch from communication library to the bank. The functions
mysql_are obsolete, usemysqli_orPDO– Costamilam
yes yes I have already made the vlw change by tip ^^
– Renan lasneaux
Since you made the change, update the question code
– Costamilam
Updated, but not sure if it is correct, I am seeking to improve
– Renan lasneaux
Thanks I didn’t realize I sent with the data.
– Renan lasneaux
What is the error message? Use this after opening the php tag to display the error messages. ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
– fajuchem
Fatal error: Uncaught Error: Call to Undefined Function mysqi_select_db() in /home/fastinv1/public_html/teste.php:14 Stack trace: #0 {main} thrown in /home/fastinv1/public_html/teste.php on line 14 esse erro ai.
– Renan lasneaux