How to translate PHP file to model in CodeIgniter?
How can I translate this PHP file to model file? I'm new in CodeIgniter.
Here is my code:
<?php
$q=$_GET['q'];
$my_data=mysql_real_escape_string($q);
$mysqli=mysqli_connect('192.168.128.30','root','root','root') or
die("Database Error");
$sql="SELECT * FROM items WHERE itemcode LIKE '%$my_data%' ORDER BY
itemcode";
$result = mysqli_query($mysqli,$sql) or die(mysqli_error());
if($result)
{
while($row=mysqli_fetch_array($result))
{
echo $row['itemcode']."\n";
}
}
?>
No comments:
Post a Comment