Select mysql data according to ID from URL address

Discuss coding issues, and scripts related to PHP and MySQL.
User avatar
JanMolendijk
Posts: 282
Location: Holland Rotterdam

Select mysql data according to ID from URL address

I need your help again i cant find out how to select a specific id to show
i have this address: jan-molendijk.16mb.com/Notice/user/index.php?page=memberslist

Their standing two names when i click on one name it does not show the data from the selected name
On this page i have this code:

Code: Select all

    echo '<br /> <a href="http://jan-molendijk.16mb.com/Notice/user/index.php?page=users&id='. $row['id']. '" title="" class="postlink" target="_self"> '. $row['name']. '  '. $row['gender']. ' '. $row['dob']. '</a> ' ;
But it select only the same name when i click on someone name because i use the wrong code like this:

Code: Select all

<?php 
session_start();
include('../connection.php');
$user= $_SESSION['user'];
$sql=mysqli_query($conn,"select * from user where email='$user' ");
$users=mysqli_fetch_assoc($sql);
?>
<?php echo $users['name'];?>
I hope my English is understanble

JanMolendijk Posts: 282
After day working i finaly found it out.
i added this code:

Code: Select all

$id = (int) $_GET['id'];
$sql = $conn->query("select * from user where id=$id");

Similar Topics