Users viewing each other's profile in php - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Tuesday, December 14, 2021

Users viewing each other's profile in php

I'm building a chat application using php. Each logged in user has it's own profile which is working fine.

But I want logged in users to view each ohers profile. But it ended up showing just 1 user profile info in all users profile. Here is my code.

Other-user-profile.php

<?php session_start();If(!isset($_SESSION['unique_id'])){header("location: login.php");}?><body><?php include_once "config.php"; $sql = mysqli_query($conn, "SELECT * FROM users WHERE NOT unique_id ={$_SESSION['unique_id']}); if(mysqli_num_rows($sql) > 0){$row = mysqli_fetch_assoc($sql);}?> <div class="info"><img src="images/<?php echo $row['image']; ?php>" alt=" "><p><?php echo $row['fname'] . " ".$row['lname']; ?php></div></body>


source https://stackoverflow.com/questions/70339102/users-viewing-each-others-profile-in-php

No comments:

Post a Comment