We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14714
    • 84 Posts
    yes my database name is communit_members and table name is modx_members

    where i have ’members’ in the snippets should i just change these to ’membersmembers’
      • 4172
      • 5,888 Posts
      I don’t know your table-prefix for this modx-installation, but seems to be ’members’ instead of ’modx_’.
      If so, then you have to change the tablename to ’membersmembers’ for getting the full tablename with $modx->getFullTableName.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 14714
        • 84 Posts
        thanks, will try that
        have you got a good reference in setting up the table
          • 14714
          • 84 Posts
          i changed the table name to membersmembers and now i get this from the call...


          Array ( [0] => Array ( [region] => North [suburb] => north adelaide [centre] => north adelaide [street] => north street [contact] => noreen [phone] => 8345 5332 [email] => [email protected] [website] => www.northern.com.au [id] => 4 ) )
            • 4172
            • 5,888 Posts
            wow, you have gotten the datas grin

            Ok now alter the code again to

            <?php
            $where=(isset($region))?'region="'.$region.'" ':'';
            $orderby ='name';
            $result=$modx->db->select('*',$modx->getFullTableName('members'),$where,$orderby );
            $rows=$modx->db->makeArray($result);
            
            $output='<table>';
            foreach ($rows as $row){
            $output.='<tr>';
            $output.='<td>'.$row['contact'].'</td>';
            $output.='<td>'.$row['street'].'</td>';
            $output.='<td>'.$row['phone'].'</td>';
            $output.='<td>'.$row['email'].'</td>';
            $output.='<td>'.$row['website'].'</td>';
            $output.='</tr>';
            }
            $output.='</table>';
            return $output;
            ?>
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 14714
              • 84 Posts
              that’s the data that i placed in manually

              just trying the setup the table correctly from the other examples in the database.

                • 14714
                • 84 Posts
                now i get...



                « MODx Parse Error »

                MODx encountered the following error while attempting to parse the requested resource:
                « Execution of a query to the database failed - Unknown column ’name’ in ’order clause’ »
                SQL: SELECT * FROM `communit_members`.`membersmembers` WHERE region="city" ORDER BY name
                [Copy SQL to ClipBoard]

                Parser timing
                MySQL: 0.0059 s (0 Requests)
                PHP: 0.0300 s
                Total: 0.0359 s
                  • 4172
                  • 5,888 Posts
                  sorry, change
                  $orderby ='name';
                  to
                  $orderby ='contact';
                  there is no field ’name’ . Let’s sort to contact, ok?
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 14714
                    • 84 Posts
                    this is what i have now... do i need ...
                    $output.=’<td>’.$row[’region’].’</td>’;
                    under the $output=’<table>’;


                    <?php
                    $where=(isset($region))?’region="’.$region.’" ’:’’;
                    $orderby =’contact’;
                    $result=$modx->db->select(’*’,$modx->getFullTableName(’members’),$where,$orderby );
                    $rows=$modx->db->makeArray($result);

                    $output=’<table>’;
                    foreach ($rows as $row){
                    $output.=’<tr>’;
                    $output.=’<td>’.$row[’region’].’</td>’;
                    $output.=’<td>’.$row[’suburb’].’</td>’;
                    $output.=’<td>’.$row[’centre’].’</td>’;
                    $output.=’<td>’.$row[’street’].’</td>’;
                    $output.=’<td>’.$row[’contact’].’</td>’;
                    $output.=’<td>’.$row[’phone’].’</td>’;
                    $output.=’<td>’.$row[’email’].’</td>’;
                    $output.=’<td>’.$row[’website’].’</td>’;
                    $output.=’</tr>’;
                    }
                    $output.=’</table>’;
                    return $output;
                    ?>
                      • 14714
                      • 84 Posts
                      yes!!!!!!!!!   i can see the data when i insert it manually but it’s not going into the database from my form - any suggestions