hi guyz what is my wrong here it's not working..
when i check 1 of checkbox then try do delete it and submit it's says only
Message Deleted Successfully
but it's really not delleted in inbox.. here's my code..
thanks for those who help me:D
when i check 1 of checkbox then try do delete it and submit it's says only
Message Deleted Successfully
but it's really not delleted in inbox.. here's my code..
PHP Code:
if(isset($_POST['submit'])) {
$pmid = safe(cleanInput($_GET["pmid"]));
$id = $_POST['check'];
foreach($_POST['check'] as $value) {
mysql_query("DELETE FROM ibwf_private WHERE id='".$value."'");
}
$del = mysql_query("DELETE FROM ibwf_private WHERE id='".$value."'");
if($del)
{
$del = mysql_query("DELETE FROM ibwf_private WHERE id='".$value."'");
echo "Message Deleted Successfully";
}else{
echo "Can't Delete Message At The Moment";
}
}
$view = safe(cleanInput($_GET["view"]));
//////ALL LISTS SCRIPT <<
if($view=="")$view="all";
if($page=="" || $page<=0)$page=1;
$myid = getuid_sid($sid);
$doit=false;
$noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."' AND folderid='0'"));
$num_items = $noi[0]; //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if($page>$num_pages)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
if($num_items>0)
{
if($doit)
{
$exp = "&rwho=$myid";
}else
{
$exp = "";
}
//changable sql
if($view=="all")
{
$sql = "SELECT
a.name, b.id, b.byuid, b.unread, b.starred FROM ibwf_users a
INNER JOIN ibwf_private b ON a.id = b.byuid
WHERE b.touid='".$myid."' AND b.folderid='0'
ORDER BY b.timesent DESC
LIMIT $limit_start, $items_per_page
";
}else if($view=="snt")
{
$sql = "SELECT
a.name, b.id, b.touid, b.unread, b.starred FROM ibwf_users a
INNER JOIN ibwf_private b ON a.id = b.touid
WHERE b.byuid='".$myid."'
ORDER BY b.timesent DESC
LIMIT $limit_start, $items_per_page
";
}else if($view=="str")
{
$sql = "SELECT
a.name, b.id, b.byuid, b.unread, b.starred FROM ibwf_users a
INNER JOIN ibwf_private b ON a.id = b.byuid
WHERE b.touid='".$myid."' AND b.starred='1'
ORDER BY b.timesent DESC
LIMIT $limit_start, $items_per_page
";
}else if($view=="urd")
{
$sql = "SELECT
a.name, b.id, b.byuid, b.unread, b.starred FROM ibwf_users a
INNER JOIN ibwf_private b ON a.id = b.byuid
WHERE b.touid='".$myid."' AND b.unread='1'
ORDER BY b.timesent DESC
LIMIT $limit_start, $items_per_page
";
}
$items = mysql_query($sql);
echo mysql_error();
while ($item = mysql_fetch_array($items))
{
$i++;
$avlink = getavatar($item[2]);
if($item[3]=="1")
{
$iml = "[_]";
}else{
if($item[4]=="1")
{
$iml = "[S]";
}else{
$iml = "[x]";
}
}
$delete = "$item[1]";
$lnk = "<form method=\"POST\" action=\"inbox.php\"><input type=\"checkbox\" name=\"check[]\" value=\"$item[1]\"><a href=\"inbox_readpm.php?pmid=$item[1]\">$iml$item[0]</a>";
$pmtext = mysql_fetch_array(mysql_query("SELECT text FROM ibwf_private WHERE id='".$item[1]."'"));
$mprev = (htmlspecialchars(strlen($pmtext[0])<20?$pmtext[0]:substr($pmtext[0], 0, 15)));
//$mtext = parsepm($mprev, $sid);
echo "$lnk: $mprev..";
echo "<br/>";
}
echo "<hr />";
/*<a href=\"inbox.php?a=all&page=1\">select all</a> with selected <select name=\"opt\"><option value=\"1\">Move to Archive</option><option value=\"2\" selected>Delete</option></select>
";*/
echo "<input type=\"submit\" value=\"Submit\" name=\"submit\">
</form></div><hr/>";
$npage = $page+1;
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"inbox.php?page=$ppage&view=$view$exp\">«Prev</a> ";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"inbox.php?page=$npage&view=$view$exp\">Next»</a>";
}
echo "<br/>$page of $num_pages<br/>";
if($num_pages>2)
{
$rets = "<form action=\"inbox.php\" method=\"get\">";
$rets .= "Go To Page: <input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
$rets .= "<input type=\"submit\" value=\"Go\"/>";
$rets .= "<input type=\"hidden\" name=\"do\" value=\"$do\"/>";
$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
$rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>";
$rets .= "</form>";
echo $rets;
}
thanks for those who help me:D
Comment