Page 1 of 1

How do I use content from one field, to UPDATE to another?

Posted: Thu Aug 01, 2013 6:21 am
by simonmlewis

Code: Select all

UPDATE categories SET titletag = 'Stone Selection: <title>''
I Want to update a load of fields to show A particular word, followed by the content of the field.

So if "title" field says "Special", I want the above script to update categories to say: Stone Selection: Special.

How do I do this?
Cannot do it with Stone Selection $title. or just entering title because it just puts that in.

I'm doing this in phpmyadmin.

Re: How do I use content from one field, to UPDATE to anothe

Posted: Thu Aug 01, 2013 7:10 am
by pbs
try using

UPDATE categories SET titletag = 'Stone Selection: '.$title.' '

Re: How do I use content from one field, to UPDATE to anothe

Posted: Thu Aug 01, 2013 7:14 am
by simonmlewis
In phpmyadmin, that just changed them all to: Stone Selection: '.$title.'

Re: How do I use content from one field, to UPDATE to anothe

Posted: Thu Aug 01, 2013 7:19 am
by pbs
it will not update through phpmyadmin, $title is PHP variable

if you have "title" field then u can do it like this

UPDATE categories SET titletag = CONCAT('Stone Selection: ', title)

may this will help you

Re: How do I use content from one field, to UPDATE to anothe

Posted: Thu Aug 01, 2013 7:22 am
by simonmlewis
Bingo - that does it in phpmyadmin. Thx