For example, in Facebook, if you enter someone's profile you can see all the user's data. I know how to get the logged in user's data. But what I don't know is how to get every single user's data and show them. I searched a lot and all what I got was how to get logged in user's data. I don't want that.

Can someone please help me out?

Recommended Answers

All 4 Replies

Wait, did you just ask how to get all 1.86 Billion Facebook user info? Can you rephrase the question?

I'm assuming that you simply want to display the details of all the users of your own script.

Lets assume you have a table named "users" that have "id", "userimage", "username", "firstname", "lastname" and "usersex" columns. You can use the "foreach" loop to display the details of each user like this:


      // query users' table to retrieve all the users' contents
      $users = query("SELECT * FROM users");
      foreach ($users as $row)
      printf("<td>" . $row["id"] . "</td>");        
      printf("<td><img src='../images/user/" . $row['userimage']."' width='100' height='159'/></td>");
      printf("<td>" . $row["username"] . "</td>");
      printf("<td>" . $row["firstname"] . "</td>");
      printf("<td>" . $row["lastname"] . "</td>");
      printf("<td>" . $row["usersex"] . "</td>");


Thanks mexabet for this information.
But I don't need that. I just need, when you click on the name of someone, it shows you the entire profile of that someone.
What I tried to do was not what I wanted. What I did was: when a new user registers, for example if that user has the id 7 and you want to go to the user with the id 4, it always shows the last user's information.

If you want members to successfully assist you, you have to post your code. Otherwise, it would be pure guessing and time-consuming.

I can only guess that you did was use a code like $row[0]["id"]; to attempt to access each user. If that is your case, try using $row["id"];

Below is an example usage:

printf("<td><a href='../profile.php?id=%d'>Michael</a></td>", $row['id']);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.