PHP - Checkbox That Records Date Of True
Hello
Was wanting you know if anyone had come across a method whereby the following occurs: On editing an existing record pulled back on a form, if a checkbox is change to TRUE (ticked) and then the record is submitted to update the database, then it should also record the date/time in a particular field e.g. 'checkboxupdate'. I already have a general update time/date field but this is updated whenever a record is updated. I want the new 'checkboxupdate' field to only be updated with the date/time when the submission includes the change to write TRUE to the checkbox field. As an aside I would need to ensure that the checkbox is read only if the value pulled back from the recordset is true........ Hope this makes sense. Thanks Demetri Similar TutorialsI am having trouble showing reports for a given date range. Currently if I specify something like 11/03/2010 to 11/05/2010 I get results for all years within that month and day such as I may get results for 11/03/2008 11/03/2009 11/03/2010 11/04/2008 11/04/2009 11/04/2010 11/05/2008 11/05/2009 11/05/2010. I am using the following code $result = mysql_query("SELECT * FROM report WHERE date>='$date_begin' and date<='$date_end' ORDER BY 'date'",$db); I use the following format in my date feild mm/dd/yyyy Hi, I am having set of records, id name dob 1 philip 1278226800 2 winsent 1278216800 3 Benn 1272226800 now i want to fetch the records based on the month and listing out, can anyone help me to write for the above concept. Thanks, still shows all records in the database... any idea how i go about this? Code: [Select] $date= date('y-m-d'); $query=mysql_query("SELECT * FROM listing WHERE date >= $date") or die (mysql_error()); Hi. Im searching for a way to enter multiple records at once to mysql databased on a date range. Lets say i want to insert from date 2010-11-23 to date 2010-11-25 a textbox with some info and the outcome could look in database like below. ---------------------------------------------------------- | ID | date | name | amount | ----------------------------------------------------------- | 1 | 2010-11-23 | Jhon | 1 | | 2 | 2010-11-24 | Jhon | 1 | | 2 | 2010-11-25 | Jhon | 1 | ----------------------------------------------------------- The reason i need the insertion to be like this is because if quering by month and by user to see vacation days then vacations that start in one month and end in another month can be summed by one month. If its in one record then it will pop up in both months. Help is really welcome. My script is finally working as intended, but I want to add some additional data results. I am trying to resolve how I can display a count of ONLY the records updated by my query: // START :: Query to replace matches mysql_query("UPDATE orig_codes_1a AS a JOIN old_and_new_codes_1a AS b ON concat(a.orig_code_1, a.orig_code_2) = concat(b.old_code_1, b.old_code_2) SET a.orig_code_1 = b.new_code_1, a.orig_code_2 = b.new_code_2") or die(mysql_error()); // END :: Query to replace matches In this query I count ALL records selection: // START :: Create query to be displayed as final results of original codes table. $result = mysql_query("SELECT * FROM orig_codes_1a") or die(mysql_error()); I want to display a count on this part of the query: ....concat(a.orig_code_1, a.orig_code_2) = concat(b.old_code_1, b.old_code_2).... $looponce = 1; foreach ($this->info as $k => $v) { if ( (($k == 'subject') && ($v['required'])) && (!$this->settings['customSubject'])) { for ($i = 0; $i <= 0; $i++) { $output[] = $this->display_errors('error_system_subject'); } } if ( (($k == 'name') && (!$v['required'])) || ((!array_key_exists("name", $this->info)) && ($looponce == 1)) ) { $output[] = $this->display_errors('error_system_name'); $looponce++; } } That is my loop that i check things in. What i'm more interested in is the name if statement. If currently checks for a name key in an array(below) and makes sure that it is set to required. If it's not set to required, print out a system error and die()'s. I'm looking for ways to remove the need for program errors and just change them to what is needed to run. What i know how to do is, get into the inner array, what i don't know is how to edit the data and put it back exactly as it was given to me. The inner array data can be put back in any order, but the outer array must be in exact order as it was given. above code $this->info = $formdata; $formdata = array( 'name' => array('name'=>"Full Name", 'required'=>false, 'type'=>'text'), # This needs to be required=>true, but i can't trust the user, which is why i have the error. 'telephone' => array('name'=>"Telephone", 'required'=>false, 'type'=>'phone'), ); Any help is greatly appreciated, also am i doing the foreach loop in the code above in an efficient manner or is there another way? Hey, I'm using a script which allows you to click on a calendar to select the date to submit to the database. The date is submitted like this: 2014-02-08 Is there a really simple way to prevent rows showing if the date is in the past? Something like this: if($currentdate < 2014-02-08 || $currentdate == 2014-02-08) { } Thanks very much, Jack Apart from the fact this can cause an infinite loop is it OK to use? $user->reset_token = $user->generate_password(32); // Make sure the token is unique while(TRUE) { $count = ORM::factory('manager')->where('reset_token', '=', $user->reset_token)->count_all(); if($count < 1) break; $user->reset_token = $user->generate_password(32); } Or would you approach the logic for this differently? Thoughts appreciated. Cheers Is there any reason why I would want to use this... Code: [Select] $_SESSION['loggedIn'] = TRUE; versus this... Code: [Select] $_SESSION['loggedIn'] = 1; (The first one is easier to read...) Debbie I am wondering if these "true" values are the same to PHP... Code: [Select] <a href="' . BASE_URL . 'members/log_in.php?addComment=true">Log In</a> Code: [Select] if (isset($_GET['addComment']) && ($_GET['addComment']==TRUE)){ Debbie hi i have set 2 varibles, and want to echo them out if they are true, i have this script but doesnt work, please help. <?php $month=$_GET['month']; $year=$_GET['year']; If($year!=0 && $month!=0) { echo $month; echo $year; } ?> cheers matt Just a silly question. I've been using 1 and 0 to tell if something is true or false, such as if a feature is enabled or not. I see that some use the words true and false. Is there a proper way or is either way correct? Thanks! <?php $id1 = '5' ; $id = array(1,2,3,4,5,6,7); foreach($id as $value){ if($id1==$value){ echo 'One of them matches, ' ; echo 'Do not execute command <BR>' ; } ////// if ends here } ////// loop ends here ?> How to do something if all statements are false ? like when id $id1 = '10' , ? Hi Not that often I play with these (and normally just a single font I use). However I am trying to generate an image with a ttf bit of text on it. No problem using Tuffy.ttf (the normal one I use), but I want to use some arrow characters which it doesn't support. I have tried using Wingding and Webdings but neither work with GD. Am I missing something (hopefully something obvious)? All the best Keith Hi, Apologies if this is rather easy but wondered how you would get around the following problem. I have a post being sent on a checked form that has the name set to a value used in my DB, for example: Code: [Select] <input type="checkbox" name="<?PHP echo $rows ["catID"] ?>"> Where name would equal something like 11. I'm trying to right some code that inserts data from the rows that have been checked, bit like the below: Code: [Select] while($rows = $database->fetch_array($result)){ $strSQL='INSERT INTO affiliate_join_cat (ajcCatID, ajcAffID) VALUES ('.$rows["catID"].', '.$_POST["affID"].')'; if ($_POST($rows["catID"])=="on"){ $database->query($strSQL); so my post will look something like 11 = on, dependent on the row checked. But there is something wrong with this part of the code: Code: [Select] $_POST($rows["catID"])=="on" my thoughts are that until catID actually equals 11 this does not evaluate to anything? So have tried using empty and isset to handle it without any success. Not sure what to do next? Thanks in advance <?php if('00' == '000') echo 'weired'; ?> Please consider the code above. Strangely it echoes the word "weired". Also if('00' == '000000000000000') returns true and so forth. What is really going on? Thanks in advance By the way the php version is 5.3.9 on wampserver 2.2 so im trying this
$file is not a .txt file
if ($file != "." && $file != ".." && !is_dir("uploads/$fuser/$file") && (pathinfo("uploads/$fuser/$file", PATHINFO_FILENAME)!= "txt")
i tried this but doesnt work
I have a statement $account = $_SESSION['account_id']; $postedby = $account_id; /*both echo out to the same number*/ if($account == $postedby){ echo "DELETE BUTTON"; } i echo'ed out both $account and $postedby and both return 1 but the if statement fails to read as true. HELP!!! thanks in advance! Hey here is my code im trying to redirect the index.php to index.php?id=1 the way i have done it doesn't look really good is there a better way to do it please? im trying to redirect to id=1 because otherwise i wont be able to echo out anything... id 1 is default category so is there a way to tell it if $id is empty echo from id 1? <?php $id = $_GET['id']; if($id == ''){ echo "<meta http-equiv=Refresh content=0;url=index.php?id=1>"; } $result = mysql_query("SELECT * FROM pages WHERE id='$id' ",$connect); while($row = mysql_fetch_assoc($result)) { echo $row['anything1']; echo $row['anything2']; } ?> |