Page 1 of 1

How do I append a character to the end of a field?

Posted: Mon Feb 01, 2016 7:45 am
by simonmlewis
I need to put a slash on the end of all rows for a particular set.

ie. Add / where type = "subcategory".
How do I do that?

Re: How do I append a character to the end of a field?

Posted: Mon Feb 01, 2016 7:50 am
by Celauran
CONCAT

Code: Select all

UPDATE table_name
SET field_name = CONCAT(field_name, '/')

Re: How do I append a character to the end of a field?

Posted: Mon Feb 01, 2016 8:41 am
by simonmlewis
That's it - thanks.
How do I query for various characters in a string. ie. , + *...etc.?

Code: Select all

if (strpos($title, '-') !== false) 
  {
    $invalidtitle = "yes";
  }
I Want to find them all and stop them being added to a field when the page turns over.

Re: How do I append a character to the end of a field?

Posted: Mon Feb 01, 2016 8:50 am
by Celauran