A heterogeneous reaction with the ammonium salt of 12-tungstophosphoric acid as catalyst has been designed for synthesis of 1,4-dihydropyridine and polyhydroquinoline via the Hantzsch condensation. Molten tetrabutylammonium bromide ionic liquid was used as reaction medium.