We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3232
    • 380 Posts
    Is it possible to export web users by group? I was thinking about doing a basic sql dump into a file but noticed that the group information is stored in a different table.

    How would one be able to associate the one table with the other and dump the results?
      • 2734
      • 165 Posts
      Thats possible with a JOIN.
      Something like this:
      SELECT * FROM modx_web_groups g LEFT OUTER JOIN modx_web_users u ON g.webuser = u.id WHERE g.webgroup = 1
      


      You’ll have to adjust the WHERE statement to your group id and possibly change the * selector to something else (unless you really want to get all fields in the result)
        • 3232
        • 380 Posts
        I keep on getting an error

        mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

        I would try to troubleshoot it but I don’t fully follow the query above.

        Should that return results as is? i am useing the following code...
        mysql_connect("localhost", "user", "pass") or die(mysql_error());
        	mysql_select_db("db") or die(mysql_error());
          	$result = mysql_query("SELECT * FROM modx_web_groups g LEFT OUTER JOIN modx_web_users u ON g.webuser = u.id WHERE g.webgroup = '1'"); 
        	
        	while($row = mysql_fetch_array($result)) {...