Welcome Guest, Not a member yet? Register   Sign In
how to update field pubilish by id Help me
#1

[eluser]Unknown[/eluser]
Hi guy!
I want change php to codeigniter, Can help me
I've table category, fields cate_id(int) , cate_name(varchar) and publish(bit)
i want
And here my code php

$id = $_GET['cate_id'];
$sql ="select * from comment where cate_id= $id order by cate_id";
$query = mysql_query($sql) or die (mysql_error());
$row = mysql_fetch_array($query);
if($row['publish'] == 0)
{
$publish = $row['publish'] + 1;
$sql_on = "update comment set publish = '$publish' where cate_id=$id";
$query_on = mysql_query($sql_on) or die (mysql_error());
}
else
{
$publish = $row['publish'] - 1;
$sql_off = "update comment set publish = '$publish' where cate_id=$id";
$query_off = mysql_query($sql_off) or die (mysql_error());

}

Thank guy!
#2

[eluser]jairoh_[/eluser]
http://www.ellislab.com/codeigniter/user...mples.html Smile




Theme © iAndrew 2016 - Forum software by © MyBB