Jump to content

[solved]sql and time <=


Craig Hopson

Recommended Posts

hi guys a simple one for you i cant get my head round it this is what i have time is stored as "time()" in database when members signup along with ther name now what i want is to show $row['name'] of all members that are 1 week old

$t = time()-604800;$result = mysql_query("SELECT * FROM members WHERE time <= $t");while($row = mysql_fetch_array($result))  {echo $row['name'];   }

Thanks

Link to comment
Share on other sites

It should be greater than.

$result = mysql_query("SELECT * FROM members WHERE time >= $t");

edit: I think you need to clarify 1 week old. Do you mean 1 week old and newer, older than 1 week, or exactly 1 week old?

Link to comment
Share on other sites

basicly i want any account older that one week it will send out email saying one week left then after 2 weeks i will delete that member and email telling them "GOODBYE"

Link to comment
Share on other sites

ok. so then what's your question then? Do you know what the operators mean?http://www.w3schools.com/sql/sql_where.asp It seems like a simple case of using if/else to check against a basic conditional.

Link to comment
Share on other sites

It should be greater than.
$result = mysql_query("SELECT * FROM members WHERE time >= $t");

edit: I think you need to clarify 1 week old. Do you mean 1 week old and newer, older than 1 week, or exactly 1 week old?

AND IT WOULD BE OLDER THAN 1 WEEK
Link to comment
Share on other sites

AND IT WOULD BE OLDER THAN 1 WEEK
easy spud. That was a post/edit from 3 hours ago. you might want to chill out if you want people to help you. So again, you know the time in the database needs to be greater than the time today minus a week if you want to contact them. Work with that and show us what you've come up with. Write some conditionals out, debug your code, and check your logic.
Link to comment
Share on other sites

sorry no affence intended i was reading back and missed a bit then replayed late i appreciate all the help i get in here without this forum when i get stuck its end off project

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...