1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

posing data into a mysql field after it has been populated.

Discussion in 'MySQL' started by darrens, May 5, 2012.

  1. #1
    Guys,

    I have a mysql databse which i access using phpmyadmin.

    The mysql database is called 'xxx_database' with a table called 'xxx_table' with multiple fields.
    I already have thousands of records in this table and all have data in a field called 'xxx_description'

    I want to add the following '<?php include_once ("_includes/field/tabbottom.php");?>' into 'xxx_description' at a fixed point within the content?

    Is this possible? In a perfect world i would like to insert '<?php include_once ("_includes/field/tabbottom.php");?>' after xxx characters but at the end of a word.
    For example:

    I am still studying at University, Malaysia pursuing Degree in Engineering. I do love new style of web design. I'm in process of becoming a successful WP Theme Developer. I like weird things, so you might want to hire me to challenge your competitors :)
    Text Lorem ipsum dolor sit amet,<b><?php include_once ("_includes/field/tabbottom.php");?></b> consectetur adipiscing elit. Nullam ultricies nulla a eros. Morbi id ipsum. Ut eu diam quis lacus ultrices posuere. Cras sagittis. Vivamus egestas quam et massa. Proin suscipit nunc ullamcorper neque

    Unless you have any other suggestions? or batter ways to do this?

    Thanks inadvance
     
    darrens, May 5, 2012 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Are you always inserting after the same text or in the same location? A simple REPLACE query could do this.

    If you need to do something more complicated like after a word, but at least x number of characters into the string, I would suggest writing a php script to pull the data from the database, looping through and logically inserting and saving each row back to the database.
     
    jestep, May 7, 2012 IP
  3. darrens

    darrens Peon

    Messages:
    808
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Jestep.

    To answer your question ...
    yes, its always the same text i want to post into the field for example = <?php include_once ("_includes/field/tabbottom.php");?>
    yes, this text will always be in the same position within the field for example after 20 words.

    Any ideas ... i dont know anything about php? can you recommend a few script?
    I dont really know anything about sql .... a developer made this site/database a few months ago and has now disappeard!
    I could manually change each field in the phpmy admin but it would take forever?

    Really i just need a command to insert <?php include_once ("_includes/field/tabbottom.php");?> after 20 words (or 20 spaces) ????
     
    darrens, May 7, 2012 IP