A sudden engine stop means one of four things: no spark, no ignition switch, no gas or no engine. No spark first. There is a fuse labeled IGN in your fusebox. If it's blown, no power gets to the coil. I find it's easier to troubleshoot these things if you just change the fuse.
If that didn't work, it may be the fuel pump relay. It's labeled EFI - electronic fuel injection - and it is exactly the same part as the taillight relay. Switch the two of them and try to start your car. If it DOES start, go during the day to an auto parts store and get two new ones.
To troubleshoot an ignition switch you need a Corolla wiring diagram and a voltmeter. Find a switched terminal and measure the voltage on it when the key is both OFF and ON. There should be 12v in the ON and 0v in the OFF.
Now for the engine. Use a 10mm wrench to remove the bolts holding the head cover on. Remove the plug wires - arrange them neatly so you know where they go - and lift the head cover off. Look at the timing belt. It should be tight. If it's broken, you need to replace it. Toyota uses non-interference engines so you only have to replace the belt rather than the belt AND the head AND a couple of pistons. You need a big impact wrench to change it because the bolt holding the harmonic balancer on is in there REALLY tight.
If that's not it, try turning the engine over with a wrench on the crank bolt. If it won't turn, you need a new car.
The engine needs fuel, compression and spark to run. You're missing one of those. The year and engine info needed to add more details.
How do I get engine codes for 1999 toyota corolla?
The 2001 Toyota Corolla has an inline 4 engine.
The 2011 Toyota Corolla has an inline 4 engine.
The 2004 Toyota Corolla has an inline 4 engine.
The 2002 Toyota Corolla has an inline 4 engine.
The 2007 Toyota Corolla has an inline 4 engine.
The 2010 Toyota Corolla has an inline 4 engine.
The 2003 Toyota Corolla has an inline 4 engine.
The 2006 Toyota Corolla has an inline 4 engine.
The 2012 Toyota Corolla has an inline 4 engine.
The 2009 Toyota Corolla has an inline 4 engine.
The 2008 Toyota Corolla has an inline 4 engine.