class Model
{
function getall($id)
{
$sql='select * from product_category where parent_id='.$id;
$rs=mysql_query($sql);
$list=array();
while($row=mysql_fetch_assoc($rs))
{
echo '
';
}
return $list;
}
function getParentCategory()
{
$sql='select * from product_category where parent_id=0';
$rs=mysql_query($sql);
$list=array();
while($row=mysql_fetch_assoc($rs))
{
$list[]=$row;
}
return $list;
}
function update($id)
{
$sql = 'UPDATE product_category SET title = "'.$_POST['title'].'"'.' WHERE id = '.$id;
mysql_query($sql);
}
function getSingleItem($id)
{
$sql='select * from product_category WHERE id = '.$id;
$rs=mysql_query($sql);
$list=array();
while($row=mysql_fetch_assoc($rs))
{
$list[]=$row;
}
return $list[0];
}
function delete($id)
{
$sql = 'DELETE FROM product_category WHERE id = '.$id;
mysql_query($sql);
}
function insert()
{
$sql='INSERT INTO product_category(title,parent_id) VALUES ("'.$_POST['title'].' ","'.$_POST['cat_id'].' ")';
//echo $sql;
mysql_query($sql);
}
}
?>
No comments:
Post a Comment