0

I'm trying to make a database of herbs with their many uses. Instead of making an individual page for every single one of them, I would like to just put the info in MySQL and call it to their appropriate pages. I have that part down no problem... but how can I get them to make their own pages?

For example, you click on the link for Lemon Balm and it generates the page automatically by pulling the database info specifically just for Lemon Balm.

1

This is beyond the scope of an answer that can be provided here. The short answer is you use PHP (generally) and when someone clicks "lemon balm" it passes the database record ID. This is then used to pull the record from the database and fill the page with data from the record.

You say you don't want an individual page for each herb, but you are going to have to enter all the data somewhere. Whether it is using a page template or into the database.

The main advantages of a database is that you can use part or all of the data elsewhere (excerpts?) and that it is sortable and searchable. Also, if you want to edit the layout, you only have to edit the single page that is the container for the data rather than every individual page - but even that is not an insurmountable problem.

I suggest you find a basic PHP/mySQL tutorial

| improve this answer | |
  • I have a separate page where I enter in the information of the herbs into the database and, on an individual basis, I can pull the data, no problem. Entering the info, storing it in the database, and pulling it is no problem. But I am trying to have a template page that pulls the information based on the link clicked, just like you said, so that it generates a page with that info. That way I don't have a million files on my server, just one that pulls the info. – Jakob Glantz Aug 27 at 23:17
  • Like I said, when the link is clicked it will pass the ID, something like example.com?herbID=123 - you then get the querystring value and look up that database record. – Steve Aug 28 at 4:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.