Here is my code:

if ($num = $i) {
echo ("<p align='left'>It's everyone's unbirthday today!</p><br>")
else {
while ($i < $num) {
echo "<br>Username: $name<br>Birthday: $day<br>City From: $city<br>On Emailing?: $email<br><br><hr><br>";
echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>If your information is wrong please email and we will change it.</font></p>");

What I want it to do is if there is a birthday show it, but if there is not a birthday say "It is everyone's unbirthday!" Should be easy but it isn't working. The while statement by itself is working, in other words I can get it to show me a list of today's birthdays, but if it is a no birthday month it isn't working. Thanks in advance for the help.

I've not looked at your code extensively but if statements need a double equals sign to do comparisons.

i.e. if (something == condition) Assuming a table as such...

pedantic_table (table name)

| id | name  | birthday   |
|  1 | Dan   | 1995-09-01 |
|  2 | Dani  | 1982-11-11 |
|  3 | Sally | 1989-10-13 |

What I would do is pipe all your data from your table into an array then compare each birthday date as you go along. If the birthday matches the curDate() show "it's your birthday" if not show "happy unbirthday"

This article has been dead for over six months. Start a new discussion instead.