[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);
}
}