Endad Rahman was under the influence of prescription drugs when he was behind the wheel on Saturday, November 9 last year.
The 35-year-old, formerly of Swindon and now living in Rochdale, Lancashire, pleaded guilty to a charge of dangerous driving.
He denied failing to provide a specimen for analysis and prosecutors said they would not pursue that matter.
Rahman admitted driving the car dangerously on Limes Avenue and Tydeman Street.
Marcus Davey, defending Rahman, said: “He had with him anti psychotic and anti depressant medication.
“When he took the medication he clearly took it incorrectly which led him to be in the condition he was in.”
Tessa Hingston, prosecuting, told the court the police never thought he had been drinking but were concerned he was under the influence of something.
“The custody record shows there were concerns and I believe he was taken to hospital straight from custody,” she said.
Recorder Maria Lamb told Rahman that his driving was appalling.
“I want you clearly to understand that this driving in any view was appalling and that you shouldn’t go away from this court thinking that there is necessarily going to be any sentence passed on you other than immediate imprisonment,” she said.
“The judge that deals with you next’s hands aren’t tied by the fact I have adjourned for a pre-sentence report and granted you bail.”