Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: rcane on February 26, 2022, 02:01:07 PM

Title: SQL query to update smf_members using conditional statements?
Post by: rcane on February 26, 2022, 02:01:07 PM
I was asked to make two custom profile fields:  State, and Congressional District #2.

I was able to get that list and have every zipcode in the US in a nice CSV:  zip / state / district#

I want to use SQL in myPhpAdmin to find a matching zipCode in a user's profile and fill in these two custom field values.

But,

1.  I see some folks messed up their zip entries (only entering 4 digits...who knows how) or didn't enter one at all. So they would need to be skipped; and

2. some zipCodes sit in more than 1 district (as many as 5 from what i see), and I'd need to concatenate district numbers with a comma.


It's not directly an SMF coding issue, but I could really use some guidance while I go comb the SQL archives "out there" to approach this.

thank you.