We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29636
    • 31 Posts
    i have an event form, which have some fields..and when the form is filled correct..i store the data in mysql table, and a email sent to registrant..

    i want in my admin side (manager) only for admins, show the registrered data...

    how can i do that..?
      • 7231
      • 4,205 Posts
      The way to do this is to use a Module to display the data. You can use the db:api functions to render the data. Sottwell has a tutorial on modules that may help: http://sottwell.com/create-module.html
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 29636
        • 31 Posts
        how can i make a html/php file only viewable inside manager folder...

        what i mean is if i f.ex put a file inside the manager folder..how can i make it not viewable for public..?
          • 4310
          • 2,310 Posts
          A module is only available inside the Manager to logged in Manager Users.
          It can be used to display, edit, delete etc. data from a database.
            • 30223
            • 1,010 Posts
            If your mySql table is in the same database as modx you could use the dbEdit module. See this post http://modxcms.com/forums/index.php/topic,32720.msg199092.html#msg199092
              • 29636
              • 31 Posts
              the modules are working great.

              but how can i f.ex export to excel file or csv file...
                • 33372
                • 1,611 Posts
                I just use something like this near the top of the module:
                // Export to CSV
                
                if(isset($_GET['exportAll'])){
                
                
                $output = '';
                
                
                $query = "SHOW COLUMNS FROM $tbl";
                
                $result = $modx->dbQuery($query);
                
                $columns = $modx->recordCount($result);
                
                
                
                $fields=array();
                
                while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                
                   array_push($fields,$row["Field"]);
                
                }
                
                
                
                   // Add the name of all fields
                
                   for ($i = 0; $i < $columns; $i++) {
                
                   $output .= '"'.$fields[$i].'",';
                
                   }
                
                   $output .="\n";
                
                
                
                $query = "SELECT * FROM $tbl ORDER BY started DESC";
                
                $result = $modx->dbQuery($query);
                
                
                
                   // Add all values in the table
                
                   while ($l = mysql_fetch_array($result)) {
                
                   for ($i = 0; $i < $columns; $i++) {
                
                   $output .='"'.$l["$i"].'",';
                
                   }
                
                   $output .="\n";
                
                   }
                
                   // Output to browser with appropriate mime type (some options below)
                   header("Content-type: text/x-csv");
                
                   //header("Content-type: text/csv");
                
                   //header("Content-type: application/csv");
                
                   header("Content-Disposition: attachment; filename=yournamehere-".date("Y-m-d").".csv");
                
                   echo $output;
                
                   exit;
                
                }


                Not sure where I came across that code originally, but it works fine for me.
                  "Things are not what they appear to be; nor are they otherwise." - Buddha

                  "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                  Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options