We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32982
    • 674 Posts
    my snipet is a simple snippet and what search a table in a database and give the values from one column
    to a button who send the variable when pressed and the button repeats
    whith all rows in the database. and before
    make a special folder or page name huhdinamic folder??? who recive the variable and send the page
    whith the data asociate to this variable by a snippets or tv
    i think every script in php could be done in modx giving the ""framework?""
    but in a easy way for little knoweledge in php
    a snippet to write a custom table in database
    a snipet to send data to the database
    a snippet to edit (could be the same but give more options)
    a snippet to search the database whith multiple configuration, dropbox multipleselect ....
    a dinamic folder who recive a variable and print the data in the same page for all data
    and a sistem to go data to the dinamic folder (whats im doing)
    and finally the snippet
    //------------------------
    // Snippet sqlmenu
    //------------------------
    // Version: 0.01
    // Date: 2005.16.08
    // [email protected]
    //------------------------
    //this menu is for show a list of values of a table in modx3 database
    //this list are buttons stylable by css and give you
    // to a unique page in modx (or another) and sending to the page the values (by variable !!!!! $label !!!!) of the button (text,numbers...)
    // and now you can change the data dinamic in one page.
    // is good for autocreation of pages by variable and whith simple call in the snippets or tv in the final page
    //you can update the page by public and pribate forms .....
    global $modx;
    //-------------------------------------------
    //name of database::::
    //------------------------------------------
    $database = "put here the name of the database";
    //-----------------------------------------
    //name of table :::::::
    //----------------------------------------
    $table = "put here the name of the table to use";
    //----------------------------------------
    //name of principal column (must be start in 0 and autoincrement)
    //------------------------------------------
    $id = "put here the name for the principal column";
    //------------------------------------------
    //----------------------------------------
    //name of column whith the data to send
    //------------------------------------------
    $data = "put here data to send variable and for the button";
    //------------------------------------------
    //page to send the variable
    //--------------------------------------
    $finalpage = "put here the page to send the variables (end)";
    //-----------------------------------------------------------------
    //class css for the button
    //-----------------------------------------
    $bottonclass = "button";
    //------------------------------------
    //code
    //---------------------------------
    for ($up=0; $up <=$maximun; $up ++){
    $maximun = $modx->db->getValue("SELECT MAX($id) FROM `$database`.$table");
    $label = $modx->db->getValue("SELECT $data FROM `$database`.$table WHERE $id = ’$up’");
    $form =’<form name="form1" method="post" action="’.$finalpage.’">
    <input name="label" type="submit" class="’.$bottonclass.’" id="enviar" value="’.$label.’"></form>’;
    echo $form;}

      Jabiertxof (formerly XYZVISUAL)
      My bussines: http://marker.es
      https://www.youtube.com/user/jabiertxof/videos
      • 33337
      • 3,975 Posts
      Thanks for the snippet xyzvisual ! smiley

      best regards,

      zi
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link