Objectives The present study, which is part of the ISRCTN16968287 clinical assay, is aimed at determining the effects of cranberry syrup or trimethoprim treatment for UTI. Methods This Phase III randomised clinical trial was conducted at the San Cecilio Clinical Hospital (Granada, Spain) with a study population of 192 patients, aged between 1 month and 13 years. Criteria for inclusion were a background of recurrent UTI, associated or otherwise with vesico-ureteral reflux of any degree, or renal pelvic dilatation associated with urinary infection. Each child was randomly given 0.2 mL/Kg/day of either cranberry syrup or trimethoprim (8 mg/mL). The primary and secondary objectives, respectively, were to determine the risk of UTI and the levels of phenolic acids in urine associated with each intervention. Results With respect to UTI, the cranberry treatment was non-inferior to trimethoprim. Increased urinary excretion of ferulic acid was associated with a greater risk of UTI developing in infants aged under 1 year (RR 1.06; CI 95% 1.024–1.1; P = 0.001). Conclusions The results obtained show the excretion of ferulic acid is higher in infants aged under 1 year, giving rise to an increased risk of UTI, for both treatment options.