Jump to content

Display users birthday?


lovephp

Recommended Posts

if your date is stored as 12/17/2014 why would you expect 12-17 to find a match?

 

try finding those that begin with "12/17"

$today = date("m/d");
$result = mysql_query("SELECT * FROM members WHERE dob LIKE '$today%'");

Dates should be stored in yyyy-mm-dd format in DATE type fields for maximum functionality, you cannot even sort dates like yours correctly.

If you only fetch one result then that is all that will be displayed. Use a while loop to loop through the returned records

$today = date("m/d");
$res = mysql_query("SELECT * FROM members WHERE dob LIKE '$today%'");
while ($rw = mysql_fetch_array($res))
{
    echo "{$rw['dob']}<br/>{$rw['name']}<br/>$today<br/><br/>";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.