So, below is my code I am using to pull account expiry data from the string ?term=[username], which then will show the expiry of the account in unix timestamp, however, it will only pull data from one username with similar characters, for example, I try to get the account expiration data for the username demo123, I use demo.net/api.php?term=demo123 to do that and I get the results, but when I try to grab account expiration data for demo124 ( Similar characters, but not exact ), I don't get any results.. ? Is there something wrong with the code, or? Any help is appreciated! I want the data to only show and output the exact results of the search string.
// Database Connection String
$con = mysql_connect($db_hostname,$db_termname,$db_password);
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_database, $con);
if (!empty($_REQUEST['term'])) {
$term = mysql_real_escape_string($_REQUEST['term']);
$sql = "SELECT * FROM users WHERE username LIKE '%".$term."%'";
$r_query = mysql_query($sql);
while ($row = mysql_fetch_array($r_query)){
echo '' .$row['expire'];
}
}
?>