PHP VAØ DATABASE
9-6
COMPUTER LEARNING CENTER
WWW.HUUKHANG.COM
Hình 10-3: Lieät keâ danh saùch saûn phaåm duyeät hay chöa
Töông töï nhö trong tröôøng hôïp delete, baïn khai baùo trang doUpdate nhö sau:
<HTML>
<HEAD>
<TITLE>::Welcome to PHP and mySQL</TITLE>
</HEAD>
<BODY>
<h3>Cap nhat mau tin</h3>
<?php
require("dbcon.php");
$strid=$chon;
$strid=str_replace(",","','",$strid);
$strfrom="";
if(isset($from_))
{
$strfrom=$HTTP_POST_VARS{"from_"};
}
$strtype="";
if(isset($type))
{
$strtype=$HTTP_POST_VARS{"type"};
}
$stSQL="";
if($strfrom<>"")
{
switch($strfrom)
{
case
"items":
$stSQL ="update tblItems set Activate=1 where ItemID
in('".$strid."')";