1
Hello I’m a beginner in php and mysql, I’ve searched everything that is singing and I still can’t understand how to associate my user url to id. I would like to know how to associate and display user data according to your url and not logged in user, I need this data to be public.
I use wordpress and the basis of the url is: /Author/user/
I used a wp_rewrite Function to leave it like this: /profile/user/
The code works well but displays data of all usernames...
<?php
$id = $_GET['id'];
$pdo = new PDO('mysql:host=localhost;dbname=', '', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$consulta = $pdo->query("SELECT user_nicename FROM users WHERE id= '$id' ");
while ($exibir = $consulta->fetch(PDO::FETCH_ASSOC)) {
// minha consulta
echo "fullname: {$exibir['user_nicename']} <br/>";
}
?>
Friend, a question. All users are authors, right? Even if they do not execute author function, because I saw that you changed the url with rewrite. But when added, do they enter the system as the correct author? /Author/user
– Fabiano Monteiro