Skip to content

Instantly share code, notes, and snippets.

@arif98741
Last active January 25, 2018 10:19
Show Gist options
  • Save arif98741/7467fa59738f1e7426e42183b738b010 to your computer and use it in GitHub Desktop.
Save arif98741/7467fa59738f1e7426e42183b738b010 to your computer and use it in GitHub Desktop.
Passing data from database in href
<?php
$con = new mysqli("localhost", "root", "", "test");
$sql = "select * from userdata"; //userdata is a table
$stmt = $con->query($sql);
if($stmt){
if($stmt->num_rows>0){
$row = $stmt->fetch_assoc();?>
<a href="something.php?userid=<?php echo $row['userid']; ?>">Go To Something Page</a>
<?php }
}
//follow this process in same way
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment