#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,600
    Rep Power
    595
    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.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by gw1500se
    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.
    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.

    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.
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7171
    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.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo