Firstly, you must make sure that the settings
table does contain a row that has the data_exp column set to todays date in the format d.m.Y.
mysql_result retrieves the contents of one cell from a MySQL result set. The cell that you are retrieving is data_exp. From your question I have assumed that data_exp is a date in the format of d.m.Y.
With that said, mysql_result($query, 0) will never be equal to 1 as it will return the date you are selecting. You could approach this in two ways, you could either check if the cell equals $data and then return true
function server_grafico_expirar($data) {
$data = sanitize($data);
$query = mysql_query("SELECT `data_exp` FROM `settings` WHERE `data_exp` = '$data'");
return mysql_result($query, 0) == $data;
}
You could also check how many rows are returned. If more than zero rows are returned then you can return true.
function server_grafico_expirar($data) {
$data = sanitize($data);
$query = mysql_query("SELECT `data_exp` FROM `settings` WHERE `data_exp` = '$data'");
return mysql_num_rows($query) > 0;
}
Please note that the mysql extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used.