SitePoint Sponsor |
|
User Tag List
Results 1 to 8 of 8
-
Apr 10, 2007, 00:12 #1
- Join Date
- Sep 2006
- Posts
- 334
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Adding Date Member Status Changed
I have a php page where I can change the status of members in my database from 'Pending' to 'Approved', when I change a member to 'Approved' they receive an email... I want to also add a date when I change them, so once they are approved a date is added into a column in my database... If anyone can give me an idea that would be great! This is what I have so far...
PHP Code:mysql_query("UPDATE `tblmembers` SET `MemberApproved`='$status' WHERE `ID`='$id'");
//get Member Info
$userInfo = mysql_query("SELECT * FROM `tblmembers` WHERE `ID`='$id'");
$q = mysql_fetch_array($userInfo);
//get Email info
if ($status == "A") {
$emailInfo = mysql_query("SELECT * FROM `email` WHERE `email_id` = 'A'");
$stat = "Approved";
}
elseif ($status == "R") {
$emailInfo = mysql_query("SELECT * FROM `email` WHERE `email_id` = 'R'");
$stat = "Rejected";
}
-
Apr 10, 2007, 00:31 #2
- Join Date
- Dec 2005
- Location
- Australia
- Posts
- 636
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Just add the column MemberApprovedDate as a timestamp.
Then add this to set the time
PHP Code:mysql_query("UPDATE `tblmembers` SET `MemberApprovedData`= NOW() WHERE `ID`='$id'");
PHP | MySQL | (X)HTML | CSS
-
Apr 10, 2007, 00:33 #3
- Join Date
- Sep 2006
- Posts
- 334
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Can I just add that directly under my first SQL Query?
-
Apr 10, 2007, 00:36 #4
- Join Date
- Sep 2006
- Posts
- 334
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Also can I add it as a DATE? I have everything set as DATE in my columns so it will just be easier, will i need to change that Query?
-
Apr 10, 2007, 00:38 #5
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
you can add it into the first query....
PHP Code:mysql_query("UPDATE `tblmembers` SET `MemberApproved`='$status', `MemberApprovedData`= NOW() WHERE `ID`='$id'");
Mike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....
-
Apr 10, 2007, 00:39 #6
-
Apr 10, 2007, 00:52 #7
- Join Date
- Oct 2006
- Location
- Kathmandu, Nepal
- Posts
- 4,013
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Create your field MemberApprovedData with the data type datetime in mysql if you are going to use NOW() function to insert the date.
Mistakes are proof that you are trying.....
------------------------------------------------------------------------
PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5
-
Apr 10, 2007, 03:02 #8
- Join Date
- Dec 2005
- Location
- Australia
- Posts
- 636
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
A timestamp is just another way of recording time. You can still fetch it, and format it, the same way as you can storing it with DATE.
Also, my mistake, I seem to have made a typo in the naming of the date field. I typed 'MemberApprovedData' instead of 'MemberApprovedDate'PHP | MySQL | (X)HTML | CSS
Bookmarks