Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 959813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:05:03+00:00 2026-05-16T01:05:03+00:00

Hey folks, I have a field within a table that I need to do

  • 0

Hey folks, I have a field within a table that I need to do a search and replace on, though it’s a bit tricky and beyond my measure of querying skills. Basically, the contents of a field may look like this:

image1.jpg
image2.jpg
image3.jpg
image4.jpg
image5.jpg

I need to do a search and replace that would replace each line with something like:

<img src="http://www.domain.com/image1.jpg" />
<img src="http://www.domain.com/image2.jpg" />
<img src="http://www.domain.com/image3.jpg" />
<img src="http://www.domain.com/image4.jpg" />
<img src="http://www.domain.com/image5.jpg" />

The image titles are completely random and could be .gif, .jpg or pngs. The table name is “exp_channel_data” and the field name is “field_id_8” and I’d be running the query in phpadmin. Is the above search and replace possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:05:03+00:00Added an answer on May 16, 2026 at 1:05 am

    I believe you can replace line breaks with a closing + opening tag and then wrap the result in an img tag to get the desired result:

    UPDATE exp_channel_data
    SET field = CONCAT(
        '<img src="http://www.domain.com/',
        REPLACE(field_id_8, '\n',  '" />\n<img src="http://www.domain.com/'),
        '" />')
    WHERE (field_id_8 IS NOT NULL) AND (field_id_8 != '')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey folks, every once in a while I have the need to automate data
Hey folks, I have a question which feels stupid but I can't quite say
Hey folks. I have a client who's old website was called toastkid.com. I set
Hey folks, hoping you can help me get started with IronRuby. I have several
Hey folks, I've got an ASP.NET web site project that for some reason is
Hey folks, ok so this is my problem, I need to display HTML code
Hey folks - I'm writing a pretty simple iPhone application. The data comes from
Hey peoples, I've been studying Java for a couple of weeks, and have decided
Hey right now I'm using jQuery and I have some global variables to hold
Hey folks. I'm looking for the best way to do something simple in symfony.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.