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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:16+00:00 2026-06-17T09:10:16+00:00

Ok I know my database is not normalized but in my case, It is

  • 0

Ok I know my database is not normalized but in my case, It is not possible to normalize the data as each user has different access level with access rights, everytime I modify something and I need to delete the rows and insert back so I went for comma-separated values, here the issue is if I remove a particular group, regex doesn’t work, it throws me an error..am using php and the error goes like this

FUNCTION database_name.REGEXP_REPLACE does not exist

Table structure

allowed_group_ids
+----------------+
12345,34345,55454

My query, say for example $delete_id is 12345 or say 55454, I only pass one ID at a time and the id’s has no space in between and it’s a text field

UPDATE tbl_scripts SET allowed_group_ids = TRIM(BOTH ',' 
FROM REGEXP_REPLACE(allowed_group_ids, '(,(\s)?)?$detele_id', '')) 
WHERE system_id = {$_SESSION['system_id']}

So what’s wrong in here?

  • 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-06-17T09:10:16+00:00Added an answer on June 17, 2026 at 9:10 am

    There is no such thing as regexp_replace in MySQL.

    You could perform this query using regular replace:

    UPDATE tbl_scripts SET allowed_group_ids = 
        trim(BOTH ',' FROM 
            replace(
                replace(allowed_group_ids, '$delete_id',','),
                ',,',
                ','
            )
        )
    WHERE system_id = {$_SESSION['system_id']}
    

    This first removes the ID, and removes any doubled-up commas, then removes any commas at the start/end of the string. This should be sufficient but you can add another replace to remove whitespace if necessary.

    Update: SQL Fiddle shows the query in action

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am woundering whether someone has time to normalize my database? I dont know
How would I know if a particular data is present in database or not?
I know implementing database is a huge topic, but I want to have a
I know how a relational database stores data. I know the basics of indexeddb
I know that there are many Delphi database related questions available, but I'm considering
I know two methods of copying a postgres database, but both of them require
I have a database design that's normalized well enough, but now I need to
I know that key-value pairs aren't good database design, aren't normalized etc however in
I know my database field name (similar to pass_hashed) but when I try to
So, the grant query for granting access for a user to a database is

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.