I'm trying to get values from the database depending on the url. So, in my db I have a column with a keystring that is a unique number that I am generating, what I want to do is: From the URL, like "example.com/?keystring=dss76da1" I can get the column value 'email' associated with this keystring and use it in the current page with a variable. My sql table
I started the code that way but I don't know if it's right.
(URL: example.com/?keystring=dss76da1):
<?php
$key = intval($_GET['keystring']);
$results = mysql_query("SELECT * FROM users WHERE keystring='".mysql_real_escape_string($key)."'");
while ($row = mysql_fetch_array($results))
What should I do to get the value of the email column that is associated with the keystring and put it in a variable? So I can use on the current page..