Get users born today
If you need a sql statement or a php script to return all the users born today, here is how you do it:
SELECT *
FROM [users_table]
WHERE DAYOFMONTH( [date_of_birth_field] ) = DAYOFMONTH(NOW())
AND MONTH( [date_of_birth_field] ) = MONTH(NOW())
The php code is this:
$sql_text = "SELECT * FROM [users_table]
WHERE DAYOFMONTH( [date_of_birth_field] ) = DAYOFMONTH(NOW())
AND MONTH( [date_of_birth_field] ) = MONTH(NOW())";
$results_query = mysql_query($sql_text);
while($results = mysql_fetch_array($results_query)){
// do something with the returned values: $results[0]...
}
Change [users_table] and [date_of_birth_field] with your table name and table field.
Tags:PHP , programming stuff , sqlPopularity: 7% [?]





$azid=date(”m-d”);
mysql_query (”select * from useri where right(data_nasterii,5)=’$azid’ “);
asta de ce nu e bun?