Anyone know how to ask a simple question with a yes or no answer, then, whatever's picked, have the date on which it was picked be displayed? For example: Did this tip work for you? Yes | No Last worked: 21 October, 2008 Or: Did this tip work for you? Yes | No Didn't work: 21 October, 2008 Any help will be rewarded with reputation points.
Hi, Two main columns: `lastvalue` `lastdate` lastdate is a timestamp => www.php.net/date lastvalue or 1 or 0 depending on the last click, i.e. 1 = Yes and 0 = No I hope that helps Jay
Not required, as from what I can see from the OP's post, they only want the last event. No point wasting database space with unneeded entries.
Thanks for the help, Jayshah! However, I wish you'd elaborated a bit more. Is this how I would create the table in MySQL? create table [I]table_name[/I] ( lastvalue emun("y", "n"), lastdate timestamp ); Code (markup): Then, what kind of PHP code would I use on my page? I want it to say this at first: Worked for you? Yes | No If someone clicks "Yes", I want it to say: Worked for you? Yes | No Last worked: 02 October, 2008 If someone then clicks "No", I want it to say: Worked for you? Yes | No Failed: 05 October, 2008
Hi, Sorry for my ambiguity. Columns, e.g.: `lastvalue` int(1) `lastdate` int(15) Code to print last click: $query = mysql_query("SELECT * FROM `table`"); $data = mysql_fetch_assoc($query); if ($data['lastvalue'] == '0'){ echo "Failed: "; } else { echo "Last worked: "; } echo date('d-m-Y', $data['lastdate']); // Change d-m-Y to your desired output using values from www.php.net/date ?> PHP: When updating, you'd do something like: $query = mysql_query("UPDATE `table` SET `lastvalue`='{$INPUT}', `lastdate`='".time()."'"); PHP: Where $INPUT is 1 or 0 depending on the click. Code is untested, but I hope this guides you further Jay