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

  • Home
  • SEARCH
  • 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 8625905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:53:25+00:00 2026-06-12T07:53:25+00:00

I am trying to append strings to a field if they do not already

  • 0

I am trying to append strings to a field if they do not already exist with:

mysql_query("UPDATE gals4 SET tags = CONCAT(tags, '$instag') WHERE id = '$instagnum' AND tags NOT LIKE '$instag'");

This just appends to ‘tags’ regardless of weather it exists in the field or not. What am i doing wrong 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-12T07:53:27+00:00Added an answer on June 12, 2026 at 7:53 am

    To answer your immediate question, you must put the character % at the beginning and end of the match string:

     "AND tags NOT LIKE '%$instag%'"
    

    However, you should be aware that this is a terrible way to store data in an SQL database. There are at least three problems:

    1. If you have tags that embed other tags (“cat” and “scat” for instance) you will find the wrong records unless you write very complicated comma-based searches.
    2. These searches can never be indexed and will therefore become very slow as the number of records grows.
    3. You cannot verify the tags used against a list of allowed tags, guarantee that only allowed tags are in the database, or easily present a list of existing or allowed tags.

    The correct solution is to add at least one table to your database, called something like gals_tags, with columns galid and tag. Insert one record per tag into this table. If a gal has more than one tag, add one record for each tag.

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

Sidebar

Related Questions

I am trying to append an image after the last input field in a
I'm trying to convert a set of strings from a txt file into int's
I'm trying to append a JSON string into a file which has already more
I'm trying to append a strings which end in newlines to a textarea using
I'm trying to remove query strings from my calendar, but my mod_rewrite is not
I'm trying to append a string of svg elements to the dom. This is
I am trying append some XML retrieved via a dojo.XHRGet to a dijit.layout.ContentPane .
I am trying to append some text to excel cell. For example if the
I am trying to append a li element to a list with a link
I'm trying to append a CSS class to a row on RowDataBound. I'm using

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.