We present a supervised neural network approach to the determination of photometric redshifts. The method was tuned to match the characteristics of the Sloan Digital Sky Survey and it exploits the spectroscopic redshifts provided by this unique survey. In order to train, validate and test the networks we used two galaxy samples drawn from the SDSS spectroscopic dataset: the general galaxy sample (GG) and the luminous red galaxies subsample (LRG). The method consists of a two steps approach. In the first step, objects are classified in nearby (z<0.25) and distant (0.25<z<0.50). In the second step two different networks are separately trained on objects belonging to the two redshift ranges. Using a standard MLP operated in a Bayesian framework, the optimal architectures were found to require 1 hidden layer of 24 (24) and 24 (25) neurons for the GG (LRG) sample. The presence of systematic deviations was then corrected by interpolating the resulting redshifts. The final results on the GG dataset give a robust sigma_z = 0.0208 over the redshift range [0.01, 0.48] and sigma_z = 0.0197 and sigma_z = 0.0238 for the nearby and distant samples respectively. For the LRG subsample we find a robust sigma_z = 0.0164 over the whole range, and sigma_z = 0.0160, sigma_z = 0.0183 for the nearby and distant samples respectively. After training, the networks have been applied to all objects in the SDSS Table GALAXY matching the same selection criteria adopted to build the base of knowledge, and photometric redshifts for ca. 30 million galaxies having z<0.5 were derived. A catalogue containing photometric redshifts for the LRG subsample was also produced.