Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to add a page in my website by which I want conduct online exams. I want that my page is activate for 3 hours only. After 3 hours the page will submit itself as happens in online exams. Can any one give me any script how to make my page time constraint?
$time = date('Y-m-d H:i:s');
extract the hour from the date and do this
if ($hour > 10800){ // 10800 which is equal to 3 hours in seconds.
submit the exam
}
don't rely on javascript to set the time because the javascript may be disabled.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Lets say there are three rows of information that loads on a site, and on the site, you only want 1 of the 3 rows to load each time the page gets refreshed, so it probably should be sorted by random or something better. what is the best code for this?
Go for array_rand()
<?php
$arr=array("Offer 1","Offer 2","Offer 3");
$val=array_rand($arr,1);
echo $arr[$val];
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In my application, the user gives 2 inputs — one is date and the other is time:
$date = date("d-M-Y");
$time=date("h:m:s");
How can I calculate a time stamp from these two variables in PHP?
actually i take the date form date picker and time from time oicker.....
If you want time stamp then use this
echo strtotime($date.' '.$time);
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do I get and set a variable to the Eastern time zone and then use it in an "if" statement?
In one of my table I have a datetime column called gameEasternTime. Values are listed like so "2013-09-22 20:30:00"
I need to show a html div only if the Eastern time is after the time listed in my gameEasternTime column.
if ( $easternTime > schedule[gameEasternTime] ) {
echo ' <div> ';
}
Use date_default_timezone_set('America/New_York') and DateTime::format . Yes, those are links.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How Can I write a PHP script or MySQL script to do a repetitive task after a period of time? One example of this could be to delete the top row of a specific table in the database every 120 seconds.
Use EVENTS
CREATE EVENT delete_top_event
ON SCHEDULE
EVERY 2 MINUTE
DO
DELETE FROM your_table order by some_column desc limit 1;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to create a simple PHP web system to “view”, “add”, “edit” and “delete” loan applications. The problem is during add new loan records to the system because i need to calculate formula for calculating "home loan" installment amount
The formula :
amount and duration is fetch during user fill up the form
Question : How i do mathematical operation to calculate installment amount from what user fill in the form to insert in mysql database? Thanks
Hope this helps.
<?php
$interest=0.5;
$amt=$_POST['amount'];
$duration=$_POST['duration']; // duration is in months
$intamt=pow((1+$interest),$duration);
$intamt2=pow((1+$interest),($duration-1));
$installment=($amt*0.5*$intamt)/$intamt2;
echo $installment;
?>
Check the working example here(http://codepad.org/Fw3wbsUP)