Did you spill soda on the shifter plate? It happened to me before and I have to remove the plate and clean it. I'm assuming that you are not trying to shift from an inclined position with Parking Brake not engaged.
The problem could be with the Shift Lock Solenoid (normally released when Ignition is ON, Shifter button is pressed and Brake Pedal depressed), Brake Pedal Switch or harness. There should be an Shift Lock Solenoid Overrride button near the base of the shifter.So if you can shift from Park to Drive with Override engaged, problem is with Shift Lock Solenoid or related circuit. Refer to the diagnosis starting on page AT-116 from the link below. It's also possible the PNP (Park?Neutral Position) switch position may need adjustment.
http://www.nicoclub.com/FSM/maxima/1995/at.pdf