1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question how i Get text from Input run SQL

Discussion in 'XenForo Development Discussions' started by bellegend, Jun 22, 2012.

  1. bellegend

    bellegend Member

    hello every one

    i have a table in my xenforo database with some data
    I want to add input to search in it with ID that visitor write it

    but i don't know how to get the ID from the User Input To The Model and Run my Sql Statement

    I tried this in ControllerPublic
    $cemdb = XenForo_Model::create('myModel');
    $cems = array();
    $identry = $this->_input->filterSingle('identry_input', XenForo_Input::STRING);
    $cemtbl = $cemdb->findcem( $identry);
    $cems = $cemtbl;
    my template FORM
    <form action="{xen:link 'cem'}" method="post" class="xenForm">
    <dl class="ctrlUnit">
    <dt><label for="ctrl_message">Your ID :</label></dt>
    <dd><input type="text" name="identry_input" class="textCtrl" id="ctrl_message"  tabindex="101" /></dd>
    <dl class="ctrlUnit submitUnit">
    <dd><input type="submit" value="Go" accesskey="s" class="button primary" /></dd>
    <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
    this is my Model function it's to simple
      //................................ sreach for id = Numreg .......................
    public function findcem($identry)
                SELECT *
                FROM 5emeres
                WHERE id = ?'
    Neeeeeed Help PLZ
  2. SmauG

    SmauG Member

    Add this to the controller:

    $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
    You shouldn't need to add anything to the template :)
    bellegend likes this.

Share This Page