[Solved] how to display data from database (MySQL)? [closed]


It would be something like this:

echo '<td><a href="https://stackoverflow.com/questions/14226828/info.php?id=".$row['id'].'">'.$row['Email'].'</a></td>';

You’re passing the user id to the info.php page. This will only work if you have an Id column called Id in your table. Alternatively you can use Email instead of Id:

echo '<td><a href="https://stackoverflow.com/questions/14226828/info.php?email=".$row["Email'].'">'.$row['Email'].'</a></td>';

Now, on the info.php you can do another query as such:

$result = mysql_query("SELECT * FROM User WHERE id = " . $_GET['id']);
while($row = mysql_fetch_array($result)){
echo $row['Age'] . ' ' . $row['Name'];
}

If you used Email instead of Id the first line needs to look like this:

$result = mysql_query("SELECT * FROM User WHERE Email = " . $_GET['email']);

Please note this is just a guideline. You’re open to sql injection and you should look into using PDO.

10

solved how to display data from database (MySQL)? [closed]