Thanks for writing your query.
After reading your post, it seems that you might have suffered from Vasovagal attack. In this blood supply to brain decreases for few seconds resulting in fainting
. Consciousness is regained when the blood supply to brain gets normal.
You should get your blood pressure and pulse rate monitored.
Also get an Electrocardiograph(ECG) and a CT(Head) done to rule out other causes.
You should drink rehydrating fluids and eat a healthy diet.
Also get yourself clinically examined.
I hope this is helpful to you.