Welcome Guest, Not a member yet? Register   Sign In
manual php to CI code
#1

[eluser]Beginers[/eluser]
Hi guys i wanna know what is the equivalent Codeigniter codes for this manual php..

please help. thanks is advance

Code:
<?php
class Autocomplete extends CI_Controller
{
    function getResult($title)
    {      
         $return_arr = array();
    
        $fetch = mysql_query("SELECT itemCode,itemDesc,itemHTS,itemECCN FROM items WHERE itemCode like'$title%' ORDER BY itemCode LIMIT 5");
    
        /* Retrieve and store in array the results of the query.*/
        while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
    
            $row_array['itemCode']       = $row['itemCode'];
            $row_array['itemDesc']       = $row['itemDesc'];
            $row_array['itemHTS']          = $row['itemHTS'];
            $row_array['itemECCN']          = $row['itemECCN'];
            array_push( $return_arr, $row_array );
        }
    
        /* Toss back results as json encoded array. */
        echo json_encode($return_arr);
    }
}
#2

[eluser]xtremer360[/eluser]
I suggest reading the docs for codeigniter. Very detailed.
#3

[eluser]TWP Marketing[/eluser]
What you want is describe on these pages of the User Guide:

http://ellislab.com/codeigniter/user-gui...index.html

Yes, it is several pages of detailed descriptions on using the CI database class.




Theme © iAndrew 2016 - Forum software by © MyBB