retrieving informaiton with random id
Posted: Sat Dec 14, 2002 10:22 pm
hey guys, i've seen topics posted on how to retrieve table data when there is a ID, normally auto_increment. My question is how to select data when there is a randomly generated id? Background of my project to help understand: i am making an ecard system where a user enters information into a form, that information is stored into a table, with a random id being created for each row. An email is then sent to the recipiant with a link that include that ID at the end i.e. viewcard.php?ID=N4OC4Fn4WnH83ng2 When the user clicks on that link i need the page to "grab" that ID and retrieve the information from that row and display it. Does anyone know how to do that? Thanks in advance for the help. Oh yea, here is the code ihave so far for that page, but no information is displayed
Code: Select all
<?
include ("dbconnect.php");
mysql_select_db("maverick") or die(mysql_error());
$id = $_GETї'id'];
$query = "SELECT * FROM information WHERE id = '$id' ";
$result = mysql_query($query) or die (mysql_error());
$row = mysql_fetch_array($result);
echo "To: $rowїrecipiant]<br />";
echo "From: $rowїsender]<br />";
echo "Email: $rowїemail]<br />";
?>