Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to restart a process and I was wondering how this can be done in PHP?

I've tried using a function but it just messes things up.

Anyone any ideas?

What I have tried:

if (isset($_POST['submit']) && ($daysLeft == 7)){
	$stmt = $conn->prepare("UPDATE Profile SET Points= $points + $Points1 WHERE UserID=$UserID");
    $stmt->execute();
	
    echo " Well done!";
}else {
    
}
// after this i want to execute to repeat the process below.......


<pre>
$daysDiff = floor(strtotime($CurrDate) - strtotime($StartDate)) / (60 * 60 * 24); 
ceil($daysDiff); 
$daysLeft = ceil($Days - $daysDiff);
echo "<div class='countholder'>You currently have  ".$daysLeft." days to complete!</div>"; 
Posted
Updated 28-Mar-18 8:16am
Comments
Mehdi Gholam 28-Mar-18 10:57am    
PHP is interpreted, restarting a process is something else, and your code has nothing to do with processes as it is a sql update statement.

Please make your mind up what you want to do first.
Member 13637584 28-Mar-18 11:01am    
Hi, basically - what the 'restart' needs to do, is update the 'days' again, what it's doing right now? E.G calculating days between two days,when the button is selected, then the days will change(i need an update statement i know etc..) But i want to know how to restart the process or will i need to paste the same code again and again??

1 solution

You should use "while" loop. Please search about while loop in php on internet.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900