date()

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
xlordt
New php-forum User
New php-forum User
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ
Contact:

date()

Postby xlordt » Mon Feb 24, 2003 5:53 am

Im tring to get a date from my database.. and send the user an email on the an event that the user has ..the part of quering the date out is easy.. but.. the part on creating a mail script to send an email on that date.. is where im confused at.. can someone post me an example on how to do this.. i figure it would go something like....
[code]

$A = mysql_query("SELECT * FROM events ORDER BY uid DESC ");
WHILE ($rows = mysql_fetch_assoc($A)){
$uid = $rows['uid'];
$datestart = $rows['datestart'];
$title = $rows['title'];
}

$today = date("Y-n-j");

if($today == $datestart){
echo $datestart;
}else{
echo $datestart;
echo "something is wrong";
}

Romantik
New php-forum User
New php-forum User
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson
Contact:

Postby Romantik » Mon Feb 24, 2003 6:23 am

You have format Y-m-d in your table?

SELECT * FROM events WHERE datestart=NEW() ORDER BY uid DESC

User avatar
xlordt
New php-forum User
New php-forum User
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ
Contact:

Postby xlordt » Mon Feb 24, 2003 6:30 am

this is what i have in my table.. 2003-02-24
so i figure.. its the same since it prints out the same

and when i did what you said i got this error...

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xlord/public_html/evnt.php on line 20
something is wrong

Romantik
New php-forum User
New php-forum User
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson
Contact:

Postby Romantik » Mon Feb 24, 2003 6:36 am

echo $today = date("Y-n-j");
echo $today = date("Y-m-d");

User avatar
xlordt
New php-forum User
New php-forum User
Posts: 34
Joined: Thu Dec 12, 2002 9:00 pm
Location: NJ
Contact:

Postby xlordt » Mon Feb 24, 2003 7:03 am

err ya see what im tring to do.. is email them on that sertain date like an auto email.. that date i added it on an event that i added just to test out the script


Return to “PHP coding => General”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest