1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SQL Query for Custom Profil Field

Discussion in 'Styling and Customization Questions' started by Pinn, Sep 1, 2014.

  1. Pinn

    Pinn Active Member

    I Need a SQL Query for my Profil Field

    ID: fakecheck
    Option: benutzer_ungeprueft

    All User to the Option: benutzer_ungeprueft

    Does anyone know of the SQL query for this?
     
  2. Amaury

    Amaury Well-Known Member

    You will need to ask in the dedicated support sections if you want support.
     
  3. Pinn

    Pinn Active Member

    Yes, I need help, need an option show a SQL query to all allow in the profile field.
     
  4. Pinn

    Pinn Active Member

  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  6. Pinn

    Pinn Active Member

    Thanks, so ok:??

    Code:
    INSERT INTO xf_user_field_value (user_id, field_id, field_value)
    SELECT user_id, 'fakecheck', 'benutzer_ungeprueft'
    FROM xf_user
    ON DUPLICATE KEY UPDATE
    field_value = VALUES(field_value);
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Correct.
     
    Pinn likes this.
  8. Pinn

    Pinn Active Member

    It is however entered nothing for anyone.
     
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

     
  10. Pinn

    Pinn Active Member

    Yes, i have.
     
  11. Pinn

    Pinn Active Member

    Option is in Checkbox is that a Problem?

    Manual is okey.
     
  12. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Checkboxes are multi-select. Those values are stored as arrays. You will end up with a query like this:

    Code:
    INSERT INTO xf_user_field_value (user_id, field_id, field_value)
    	SELECT user_id, 'field_id', 'a:1:{s:5:"value";s:5:"value";}'
    	FROM xf_user
    ON DUPLICATE KEY UPDATE
    	field_value = VALUES(field_value);
    
    This is serialized data. Be careful that the string lengths match the value.
     
    Pinn likes this.
  13. Pinn

    Pinn Active Member

    Yes it works:

    Code:
    INSERT INTO xf_user_field_value (user_id, field_id, field_value)
        SELECT user_id, 'fakecheck', 'a:1:{s:13:"benutzer_echt";s:19:"benutzer_ungeprueft";}'
        FROM xf_user
    ON DUPLICATE KEY UPDATE
        field_value = VALUES(field_value);
     

Share This Page