Question how i Get text from Input run SQL

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
Code:
$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
HTML:
<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>
<dl class="ctrlUnit submitUnit">
<dt></dt>
<dd><input type="submit" value="Go" accesskey="s" class="button primary" /></dd>
</dl>
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>

this is my Model function it's to simple
PHP:
  //................................ sreach for id = Numreg .......................
    public function findcem($identry)
    {
 
      return $this->_getDb()->fetchRow('
            SELECT *
            FROM 5emeres
            WHERE id = ?', $identry);
 
    }
//******************************

Neeeeeed Help PLZ
 
Add this to the controller:

Code:
$userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);

You shouldn't need to add anything to the template :)
 
Top Bottom