Jump to content

[SOLVED] why


ccrevcypsys

Recommended Posts

Does it just go to the main page after i hit delete.

 

I really dont understand this someone please please help me. I need it badly!

When i click on delete above the song it is supposed to delete the song off of the database but instead of doing that it just sends me back to the index page. here is the code

 

<?php
$products = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_inventory WHERE ".$glob['dbprefix']."CubeCart_inventory.customer_id=".$db->mySQLsafe($ccUserData[0]['customer_id']));
if($products == TRUE){	
			if(isset($_GET['delete']) && $_GET["delete"]>0){
	// delete product
	$where = "productId=".$db->mySQLSafe($_GET["delete"]);
	$delete = $db->delete($glob['dbprefix']."CubeCart_inventory", $where);
	// set categories -1
	$cats = $db->select("SELECT cat_id FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE productId=".$db->mySQLSafe($_GET["delete"]));
	if($cats==TRUE){
		for($i=0;$i<count($cats);$i++){
				$db->categoryNos($cats[$i]['cat_id'], "-");
		}
	}
	// delete category index
	$where = "productId=".$db->mySQLSafe($_GET["delete"]);  
	$deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where);
	unset($record);
	// delete product options
	$record['product'] = $db->mySQLSafe($_GET["delete"]);
	$where = "product=".$db->mySQLSafe($_GET["delete"]);  
	$deleteOps = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where);
	unset($record);}
?>

[<a href="javascript:decision('Are you sure you want to delete this?','?delete={PRODUCT_ID}&cat_id={CAT_ID}');">{LANG_DELETE_LINK}</a>]   </table></td>

Link to comment
Share on other sites

madtechie im sorry but i am a n00b at php so what statements do i echo?

Here is the delete function from the db.inc.php class page

	function delete($tablename, $where, $limit="")
{
	$query = "DELETE from ".$tablename." WHERE ".$where;
	if ($limit!="") $query .= " LIMIT " . $limit;
	$this->query = $query;
	mysql_query($query, $this->db);

	if ($this->error()) die ($this->debug());

	if ($this->affected() > 0){ 
		return TRUE; 
	} else { 
		return FALSE;
	}

} // end delete

Link to comment
Share on other sites

it still just returns me to the index page

 

well hey it works in the admin section and this is the code from the admin section (thats where i got the query echo from).

is it because on the customers section i took the permission off?

if(permission("products","read")==FALSE){
header("Location: ".$GLOBALS['rootRel']."admin/401.php");
exit;
}
if(isset($_GET['delete']) && $_GET["delete"]>0){

	// delete product
	$where = "productId=".$db->mySQLSafe($_GET["delete"]);
	$delete = $db->delete($glob['dbprefix']."CubeCart_inventory", $where);

	// set categories -1
	$cats = $db->select("SELECT cat_id FROM ".$glob['dbprefix']."CubeCart_cats_idx WHERE productId=".$db->mySQLSafe($_GET["delete"]));
	if($cats==TRUE){

		for($i=0;$i<count($cats);$i++){

				$db->categoryNos($cats[$i]['cat_id'], "-");

		}

	}

	// delete category index
	$where = "productId=".$db->mySQLSafe($_GET["delete"]);  
	$deleteIdx = $db->delete($glob['dbprefix']."CubeCart_cats_idx", $where);
	unset($record);

	// delete product options
	$record['product'] = $db->mySQLSafe($_GET["delete"]);
	$where = "product=".$db->mySQLSafe($_GET["delete"]);  
	$deleteOps = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where);
	unset($record);

	if($delete == TRUE){

		$msg = "<p class='infoText'>".$lang['admin']['products']['delete_success']."</p>";

	} else {

		$msg = "<p class='warnText'>".$lang['admin']['products']['delete_fail']."</p>";

	}

   <td align="center" width="10%" class="<?php echo $cellColor; ?>"><a <?php if(permission("products","delete")==TRUE){ ?>href="javascript:decision('<?php echo $lang['admin']['delete_q'];?>','?delete=<?php echo $results[$i]['productId']; ?>&cat_id=<?php echo $results[$i]['cat_id']; ?>');" class="txtLink"<?php } else { echo $link401; } ?>><?php echo $lang['admin']['delete'];?></a></td>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.