How to get All Column names of table in magento 2

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












I created a custom form in admin using block(without UI component). So i want to get all columns of my custom table in form block file. Please suggest me.










share|improve this question









New contributor




Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    1
    down vote

    favorite












    I created a custom form in admin using block(without UI component). So i want to get all columns of my custom table in form block file. Please suggest me.










    share|improve this question









    New contributor




    Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I created a custom form in admin using block(without UI component). So i want to get all columns of my custom table in form block file. Please suggest me.










      share|improve this question









      New contributor




      Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I created a custom form in admin using block(without UI component). So i want to get all columns of my custom table in form block file. Please suggest me.







      magento2 database blocks






      share|improve this question









      New contributor




      Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 34 mins ago









      Charul Tyagi

      57712




      57712






      New contributor




      Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 57 mins ago









      Alpeshsinh Solanki

      85




      85




      New contributor




      Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Alpeshsinh Solanki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Try this add New function in your custom resource model and call that function where you want to display.



          public function getFields()

          $fields = $this->getConnection()->describeTable($this->getMainTable());
          return $fields;






          share|improve this answer
















          • 1




            Thanks it is working fine.
            – Alpeshsinh Solanki
            32 mins ago










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Alpeshsinh Solanki is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f245471%2fhow-to-get-all-column-names-of-table-in-magento-2%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          Try this add New function in your custom resource model and call that function where you want to display.



          public function getFields()

          $fields = $this->getConnection()->describeTable($this->getMainTable());
          return $fields;






          share|improve this answer
















          • 1




            Thanks it is working fine.
            – Alpeshsinh Solanki
            32 mins ago














          up vote
          2
          down vote



          accepted










          Try this add New function in your custom resource model and call that function where you want to display.



          public function getFields()

          $fields = $this->getConnection()->describeTable($this->getMainTable());
          return $fields;






          share|improve this answer
















          • 1




            Thanks it is working fine.
            – Alpeshsinh Solanki
            32 mins ago












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Try this add New function in your custom resource model and call that function where you want to display.



          public function getFields()

          $fields = $this->getConnection()->describeTable($this->getMainTable());
          return $fields;






          share|improve this answer












          Try this add New function in your custom resource model and call that function where you want to display.



          public function getFields()

          $fields = $this->getConnection()->describeTable($this->getMainTable());
          return $fields;







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 36 mins ago









          poojan sharma

          1504




          1504







          • 1




            Thanks it is working fine.
            – Alpeshsinh Solanki
            32 mins ago












          • 1




            Thanks it is working fine.
            – Alpeshsinh Solanki
            32 mins ago







          1




          1




          Thanks it is working fine.
          – Alpeshsinh Solanki
          32 mins ago




          Thanks it is working fine.
          – Alpeshsinh Solanki
          32 mins ago










          Alpeshsinh Solanki is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Alpeshsinh Solanki is a new contributor. Be nice, and check out our Code of Conduct.












          Alpeshsinh Solanki is a new contributor. Be nice, and check out our Code of Conduct.











          Alpeshsinh Solanki is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f245471%2fhow-to-get-all-column-names-of-table-in-magento-2%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery