
629 So.2d 693 (1993)
Roosevelt CUNNY
v.
STATE.
CR-91-1629.
Court of Criminal Appeals of Alabama.
February 12, 1993.
Rehearing Denied March 26, 1993.
Certiorari Denied June 25, 1993.
*694 Joan Singleton, Bessemer, for appellant.
James H. Evans, Atty. Gen., and Anita Young, Asst. Atty. Gen., for appellee.
Alabama Supreme Court 1921018.
TAYLOR, Judge.
The appellant, Roosevelt Cunny, was convicted of the distribution of a controlled substance, cocaine, a violation of § 13A-12-211, Code of Alabama 1975. At the sentencing hearing, the trial court, ex mero motu, invoked the Habitual Felony Offender Act, § 13A-5-9, Code of Alabama 1975 (HFOA), and sentenced the appellant to 10 years' imprisonment. The trial court also took judicial notice of where the crime occurred and imposed an additional sentence of five years' imprisonment, because the sale took place within three miles of a school campus. See § 13A-12-250, Code of Alabama 1975.

I
The appellant first contends that the trial court erred by sentencing him as a habitual offender because, he says, he was not given notice that his prior felony conviction would be used to enhance his sentence. In this case the trial court, ex mero motu, invoked the HFOA and increased the appellant's sentence accordingly. The attorney general concedes that a new sentencing hearing is warranted. We agree.
The application of the HFOA is not discretionary but mandatory. McClaren v. State, 500 So.2d 1325 (Ala.Cr.App.1986). Section 13A-5-9 provides:
"(a) In all cases when it is shown that a criminal defendant has been previously convicted of any felony and after such conviction has committed another felony, he must be punished as follows:
"(1) On conviction of a Class C felony, he must be punished for a Class B felony;

*695 "(2) On conviction of a Class B felony, he must be punished for a Class A felony;
"(3) On conviction of a Class A felony, he must be punished by imprisonment for life or for any term of not more than 99 years but not less than 15 years.
"(b) In all cases when it is shown that a criminal defendant has been previously convicted of any two felonies and after such convictions has committed another felony, he must be punished as follows:
"(1) On conviction of a Class C felony, he must be punished for a Class A felony;
"(2) On conviction of a Class B felony, he must be punished by imprisonment for life or for any term of not more than 99 years but not less than 15 years;
"(3) On conviction of a Class A felony, he must be punished by imprisonment for life or for any term of not less than 99 years.
"(c) In all cases when it is shown that a criminal defendant has been previously convicted of any three felonies and after such convictions has committed another felony, he must be punished as follows:
"(1) On conviction of a Class C felony, he must be punished by imprisonment for life or for any term not more than 99 years but not less than 15 years;
"(2) On conviction of a Class B felony, he must be punished for life in the penitentiary;
"(3) On conviction of a Class A felony, he must be punished by imprisonment for life without parole."
(Emphasis added.)
This court held in Reynolds v. State, 488 So.2d 4 (Ala.Cr.App.1985), that the trial court has no discretion as to whether a habitual felon should be punished under the HFOA. The prosecutor has a legal duty to produce evidence of prior convictions if he is aware of any. Id. In actual practice, F.B.I. "rap sheets" are sought by the prosecutor and secured, if they exist, on all persons accused of felonies. Invocation of the HFOA cannot be used by the prosecution as a bargaining chip.
Although application of the HFOA is mandatory, the state must still comply with Connolly v. State, 602 So.2d 452 (Ala. 1992). The Alabama Supreme Court, in Connolly, stated that a defendant must be given notice of two things with respect to sentencing before the HFOA may be invoked. He must be given notice of the state's intention to invoke the HFOA at sentencing and he must be given notice of the specific prior felony convictions on which the state intends to rely. Connolly, supra. Written notice to the defendant is not required; oral notice is sufficient. Garrett v. State, 480 So.2d 58 (Ala.Cr.App.1985). However, this notice requirement is eliminated when, during the trial, the defendant admits a previous felony conviction. Connolly, supra, citing Petite v. State, 520 So.2d 207 (Ala.Cr.App.1987). The notice requirement cannot be avoided, however, by putting a defendant on the witness stand at the sentencing hearing and securing from him admissions as to prior felony convictions. Bogan v. State, 607 So.2d 322 (Ala. Cr.App.1992).
In this case, the state did not move to invoke the HFOA. Instead, the trial court, ex mero motu, invoked the HFOA and increased the appellant's sentence. The issue then becomes: May the trial court invoke the mandates of the HFOA absent a motion from the prosecution? Neither § 13A-5-9, Code of Alabama 1975, nor Rule 26.6(b)(3), A.R.Crim.P., addresses the question of how to proceed if the district attorney fails or refuses to invoke the application of the HFOA. Because the application of the HFOA is mandatory, we hold that the trial court may invoke the HFOA on its own motion. However, when the trial court invokes the HFOA on its own motion, the principle still applies that the defendant must be given reasonable notice of the intention to invoke the HFOA and reasonable notice of the specific prior felony convictions on which it will rely. Again, prior notice is not required where the defendant testifies at trial and admits to any previous felony convictions. In this case, the appellant was not given reasonable notice of its intention to invoke the HFOA. Thus, the sentence pronounced *696 by the court is invalid, and the appellant is entitled to a new sentencing hearing.

II
The appellant next contends that his sentence was incorrectly enhanced under § 13A-12-250, Code of Alabama 1975, Alabama's "schoolyard statute." Specifically, he argues that the trial court erred in invoking this statute because, he says, the prosecution failed to present any evidence that the sale occurred within a three-mile radius of a school campus. We agree.
The application of § 13A-12-250, like the application of the HFOA, is mandatory. Green v. State, 586 So.2d 54 (Ala.Cr. App.1991). As is the case with the HFOA, before the schoolyard statute may be invoked, the state must give the defendant prior notice of its intention to proceed under that statute. Wright v. State, 560 So.2d 1128 (Ala.Cr.App.1989). Oral notice is sufficient. Id. See also Grider v. State, 600 So.2d 401 (Ala.Cr.App.), cert. denied, Ex parte Brooks, 600 So.2d 404 (Ala.1992).
Further, at the sentencing hearing, the state must prove by "the preponderance of evidence" that the sale occurred within a three-mile radius of a school campus. Ex parte Johnson, 597 So.2d 1305, 1306 (Ala. 1991). See also Rule 26.6(b)(2), A.R.Crim.P. This second requirement is met if a witness testifies that he has measured the distance from the school campus to the location of the sale and that the site of the sale is within the three-mile radius. Walker v. State, 594 So.2d 722 (Ala.Cr.App.1991); Lane v. State, 564 So.2d 90 (Ala.Cr.App.1990). It is not sufficient for the trial court to take judicial notice of the fact that the crime occurred within three miles of a school campus. Johnson, supra; Hester v. State, 597 So.2d 1307 (Ala.Cr.App.1992).
Here, the trial court, again ex mero motu, took judicial notice of the fact that the sale occurred within three miles of the Jonesboro School and thereby enhanced the appellant's sentence accordingly. The prosecution offered no proof of the relative distance and the appellant was not given notice of the court's intent to invoke the statute. Because the requisite notice was not given to the appellant and proof of the location of the crime was not offered, the appellant is entitled to a new sentencing hearing. See Rule 26.6(b)(2), A.R.Crim.P.
The appellant expresses concern in his reply brief that the trial court in resentencing him on remand will impose an additional five-year penalty under the "public housing authority statute," § 13A-12-270, Code of Alabama 1975, which mandates an additional five years' imprisonment if the sale occurred within a three-mile radius of a public housing project. If the state gives the requisite notice to the appellant of its intent to invoke that statute and evidence is presented that the sale occurred within a three-mile radius of a public housing project, then the additional five-year sentence shall be imposed. Section 13A-12-270 provides:
"In addition to any penalties heretofore or hereafter provided by law for any person convicted of an unlawful sale of a controlled substance, there is hereby imposed a penalty of five years incarceration in a state corrections facility with no provision for probation if the situs of such unlawful sale was within a three-mile radius of a public housing project owned by a housing authority."
Application of both § 13A-12-250 and § 13A-12-270 is mandatory. Burks v. State, 611 So.2d 487 (Ala.Cr.App.1992); Green, supra. Both statutes contain the language "in addition to any penalties heretofore or hereafter provided by law." Therefore, these additional penalties must be added to any other penalty imposed when the requisite proof is given.
Because the sentence originally pronounced by the court was invalid, the appellant must be resentenced. If, at the new sentencing hearing, evidence is presented by the state that the sale occurred within a three-mile radius of a school campus, an additional five years' imprisonment must be added to the appellant's sentence. Also, if the prosecution proves by a preponderance of the evidence that the cocaine sale occurred within a three mile radius of a public housing *697 project, then the appellant's sentence must be further enhanced. Section 13A-12-250 and § 13A-12-270, Code of Alabama 1975.
Further, if at the new sentencing hearing either the trial court or the prosecution gives the appellant the requisite notice requirements and proves that the appellant has a prior felony conviction, the appellant must be sentenced according to the Habitual Felony Offender Act.
For the foregoing reasons, this cause is remanded to the Circuit Court for Jefferson County, Bessemer Division, so that it may conduct a new sentencing hearing not inconsistent with this opinion. Due return shall be filed with this court within 28 days from the date of this opinion.
REMANDED WITH DIRECTIONS.
All the Judges concur.
