January 26th, 2013, 04:41 PM
Include PHP file in Mysql db table/field
I have a unique site that displays lists of information for our users. No list is the same so I stored the list in a field for each record, over 100,000. Each list has up to 20 items on it and are unique to each record, no 2 lists are the same.
I listed the information in a field of the db table that includes some html br codes etc I want to include a hyperlink for each item on the list using a php script include file, that way i can change the links easily in one file whenever they change.
So, I need to call the file via an include statement within the mysql table? How do I accomplish this task?
Thanks for your help.
January 26th, 2013, 05:18 PM
Just put the file name in the table and use that string in the include statement of your PHP script when it is returned by the query.
There are 10 kinds of people in the world. Those that understand binary and those that don't.
January 26th, 2013, 06:04 PM
The problem is each item in the list is going to have a separate file that will add the appropriate hyper link. So one record may have 20 items in a list, each item has a separate file that will call a link, another record may have 30 items and need to call each of those items.
Originally Posted by gw1500se
I'm new to coding php for the most part, just not sure how to go about this properly. My feeling is to include the file that holds the url before each line item in the db field that holds the list but of course the php code won't run that way.
January 26th, 2013, 08:00 PM
Can you post the structure of your database tables; it sounds like they may be set up incorrectly.
You can't run PHP code in a MySQL field, you have to do something along the lines of what gw1500se said.