We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5119
    • 90 Posts
    I’ve been able to extract all our new subscribers so that they can be billed via a SQL query, but the ’country’ records come out as numbers (indexed against a file on the server that lists a country code for each country).

    Is there any way that I can get my SQL query to include the company name? Apologies for the dumb question - I haven’t used SQL since Uni.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Unfortunately the country field is handled as numbers. You’ll need to use that &country_lang array to switch the output from the number to its associated name in your result set handling.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 5119
        • 90 Posts
        Yes, I will. That’s the bit I don’t know how to do.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Include the appropriate country file. Get the country value from the query, and have
          $country = $country_lang[$value];

          in your code.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 5119
            • 90 Posts
            Thank you to you both. I’m familiar with the file, but my SQL is beyond rusty.

            So far, at a guess, and incomplete, I have:

            include /public_html/manager/includes/lang/country/english_country.inc.php
            SELECT *
            FROM `modx_web_user_attributes`
            WHERE `id` > '415'
            
            SELECT *
            FROM 'english_country.inc.php'
            
            $country = $country_lang[$value];
              • 5119
              • 90 Posts
              ganesh, thanks for that - it’s just what I needed. It’s all working perfectly. grin