I just brought a 2009 Pontiac G6 Gt, when i put the car in park it shut off. on 2009 Pontiac G6

I tried to start the car but it wont start. The lights and power are still on but the car just wont start,Why?

Asked by for the 2009 Pontiac G6
does it crank but not start or no crank?
Thanks for replying back....We have it resolved, my car is still under warranty so they fixed the problem....Thanks for your respond...