Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » SQL query

#1 2006-10-15 11:17:29

ricetxp
Member
From: London, UK
Registered: 2005-05-24
Posts: 89
Website

SQL query

I need help replacing a value in a custom field. I want to replace “1” with “A Full Name”.

I have been using numbers in a custom field as a short cut, rather than writing a person’s name. I’ve then been using <txp:if_custom_field name="review" val="1">Full Name</txp:if_custom_field> This has worked fine, but I’ve made the custom field searchable. So you can search for the value 1, but not the person’s name.

Can anyone tell me the sql query I need to write to replace the value?

Thanks
Ed

Offline

#2 2006-10-15 12:35:18

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: SQL query

UPDATE txp_textpattern SET custom_1 = ‘your name’ WHERE custom_1 = 1;

Offline

#3 2006-10-15 13:36:39

ricetxp
Member
From: London, UK
Registered: 2005-05-24
Posts: 89
Website

Re: SQL query

Thanks, worked a treat!

In case anyone else uses this code, I ended up using this via Rob Sable’s db plugin:
UPDATE textpattern SET custom_4 = 'Replacement Text' WHERE custom_4 = 1

Offline

  1. Index
  2. » How do I…?
  3. » SQL query

Board footer

Powered by FluxBB