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 6820251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:24:10+00:00 2026-05-26T21:24:10+00:00

I have some columns in my table, descriptions column contains some information like; a1b01,Value

  • 0

I have some columns in my table, descriptions column contains some information like;

a1b01,Value 1,2,1,60|a1b01,Value2,1,1,50|b203c,Value 1,0,2,20

with a SQL command, i need to update it.

In there, I’ll use a PHP function for updating, if first and second parameters exist in current records (in description column) together.

Eg: if user wants to change the value of description that includes a1b01,Value 1 I’ll execute a SQL command like that;

function do_action ($code,$value,$new1,$new2,$newresult) {
UPDATE the_table SET descriptions = REPLACE(descriptions, $code.','.$value.'*', $code.','.$value.','.$new1.','.$new2.','.$newresult)";
}
  • (star) indicates that, these part is unknown (This is why i need a regex)

My question is : how can i get

a1b01,Value 1,2,1,60| 

part from below string

a1b01,Value 1,2,1,60|a1b01,Value2,1,1,50|b203c,Value 1,0,2,20 

via regex, but a1b01 and Value 1 should be get as parameter.

I just want that; when I call do_action like that;

do_action ("a1b01","Value 1",2,3,25);

record will be : a1b01,Value 1,2,3,25|a1b01,Value2,1,1,50|b203c,Value 1,0,2,20
(first part is updated…)

  • 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-26T21:24:10+00:00Added an answer on May 26, 2026 at 9:24 pm

    You don’t necessarily need to use a regular expression to do this, you could use the explode function since it is all delimited

    So you could do as follows:

    $descriptionArray = explode('|', $descriptions); //creates array of the a1b01,Value 1,2,1,60 block
    //then for each description explode on ,
    for($i = 0; i < count($descriptionArray); $i++){
        $parameters = explode(',', $descriptionArray[$i]); 
        do_action ($parameters[0],$parameters[1],$parameters[2],$parameters[3],$parameters[4]);
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some extended property column descriptions in a SQL Server 2008 database, and
I have some data I am querying. The table is composed of two columns
I have a table that, some of its columns are unknown at compile time.
i have made columns in some of the tables encrypted in sql server 2008.
I have a table with a column 'A'. Some rows have 14 digits for
i have one database, and it contains some columns. My requirement is that how
I have been trying to add columns to a table using some logic that
I have a table that contains three pieces of patient information. Diagnosis_ID Patient_ID Diagnosis_Code
I have a table in Oracle with a VARCHAR column called DESCRIPTION. Some of
I have a description column in my SQLite database that contains some text to

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.