Location: PHPKode > projects > Simple PHP Shopping cart - asaancart > asaancart v-0.9/admin/select_set_attrib_value.php
<?php
session_start();
/*
asaancart - easy shopping cart solution
---------------------------------------

Copyright 2009 Nasir Ahmad Khan
Email: hide@address.com

This file is part of asaancart - open source easy shopping cart solution.

asaancart is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

asaancart is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with asaancart.  If not, see <http://www.gnu.org/licenses/>.

*/

include("../config/config.php");
include("includes/chk_login_status_inc.php");

$set_id = $_GET['set_id'];
$attribute_id = $_GET['attribute_id'];
$id = $_GET['id'];
$attribute_name = $_GET['attribute_name'];
$smarty->assign('set_id',$set_id);	
	
if($_GET['mode']=='select'){
	if($attribute_id != ""){
		$sql = "INSERT INTO attribute_set_value (attribute_id, attribute_name, set_id) VALUES (".$attribute_id.", '".$attribute_name."',".$set_id.")";
		$results = mysql_query($sql);
		$smarty->assign('msg_attrib_value','Done: Created Successfully');
	}else{
		$smarty->assign('msg_attrib_value','Error: Please select attribute first');
	}
}

if($_GET['mode']=='delete'){

	$sql = "DELETE FROM attribute_set_value WHERE id=".$id;
	$results = mysql_query($sql);
	$smarty->assign('msg_attrib_value','Done: Deleted Successfully');
	
	
}

	$sql = "SELECT * FROM attribute";
	$results = mysql_query($sql);
	$total_attrib = mysql_num_rows($results);
	$smarty->assign('total_attrib', $total_attrib);
	
	while($row = mysql_fetch_assoc($results) )
	{
		$all_attrib_list[] = $row;		
	}
	
	$smarty->assign('all_attrib_list', $all_attrib_list);
	
	
	
	$sql = "SELECT * FROM attribute_set_value WHERE set_id=".$set_id;
	$results = mysql_query($sql);
	$total_selected = mysql_num_rows($results);
	$smarty->assign('total_selected', $total_selected);
	
	while($row = mysql_fetch_assoc($results) )
	{
		$show_selected_attrib[] = $row;		
	}
	
	$smarty->assign('show_selected_attrib', $show_selected_attrib);
	
	
	

$smarty->display('selected_attrib_list.tpl');

?>
Return current item: Simple PHP Shopping cart - asaancart