Typically you want to avoid checking a database to determine when to perform an action, in your case, test the code the user submits. This is because polling a database like this, particularly every second, is very resource intensive. So, you might want to try just running the code when the user enters it, and then save it, thereby avoiding the whole "check the database" step, and just retrieve the code when the user needs it again (this is called event-driven programming, if you're curious). I'm afraid I can't offer any specifics on how to test the code using PHP (I'm more of a Java guy), but these are just some thoughts to keep in mind as you design your project.
Typically you want to avoid checking a database to determine when to perform an action, in your case, test the code the user submits. This is because polling a database like this, particularly every second, is very resource intensive. So, you might want to try just running the code when the user enters it, and then save it, thereby avoiding the whole "check the database" step, and just retrieve the code when the user needs it again (this is called event-driven programming, if you're curious). I'm afraid I can't offer any specifics on how to test the code using PHP (I'm more of a Java guy), but these are just some thoughts to keep in mind as you design your project.
Hope this helps!
It helps, thank you!