Match a value in database and get all data in this row using codeigniter
<p>i want if user input a number or username if value is matched in column get all data in this single row.
Here is My Code but show Error.</p>

<p><strong>Model</strong>  </p>

<pre><code>public function ven_coupon($coupon)
    {
        $where = array(
            'number' =&gt; $coupon,
        );
        $this-&gt;db-&gt;select()
                 -&gt;from('vendor_coupons')
                 -&gt;where($where);
        $data = $this-&gt;db-&gt;get();
        return $data-&gt;result_array();
    }
</code></pre>

<p><strong>Controller</strong></p>

<pre><code>public function ven_coupon()
    {
        if ($_POST) {
            $number = $_POST['coupon'];
            $query = $this-&gt;front-&gt;ven_coupon($number);
            if (count($query) &lt;= 0 ) {
                echo "Not Valid";
            }
            $payment = $this-&gt;cart-&gt;total();
            $discount['discount'] = ($payment*10)/100;

            $discount['data'] = $this-&gt;front-&gt;ven_coupon($number);
            $this-&gt;load-&gt;view('checkout',$discount);
        }
    }
</code></pre>

<p><strong>View</strong></p>

<pre><code>&lt;form action="&lt;?=base_url();?&gt;home/ven_coupon" method="post"&gt;
            Coupon: &lt;input type="text" name="coupon"&gt;
            &lt;input type="submit" name="submit" value="Apply Coupon"&gt;
        &lt;/form&gt;
        &lt;?php if($discount) { ?&gt;
            &lt;p&gt;Discount: 10%&lt;/p&gt;
            &lt;p&gt;Total: &lt;?=$discount;?&gt;&lt;/p&gt;
            &lt;?=$data['discount'];?&gt;
            &lt;?=$data['number'];?&gt;
        &lt;?php } ?&gt;
</code></pre>