Jump to content

Recommended Posts

I am working on a database driven  website where people can come log in and  buy items and when they go into their account page they can view their items in different categories by pressing buttons on the side. One of the buttons  refuses to work. Here's my flash code:


var itemsVars:LoadVars = new LoadVars();
itemsVars.onLoad = loadItems;
itemsVars.load("load_items.php?id=" + id + "&doll_id=" + doll_id);

var wornItemsVars:LoadVars = new LoadVars();
wornItemsVars.onLoad = loadWornItems;

var furniture:Array = new Array();

function loadItems(success)
{
if (success)
{
	for(var i = 0; i < this.items; i++)
	{
		var newClip = clothing.duplicateMovieClip("clothing" + i, _root.getNextHighestDepth());

		if (this["item_type" + i] == "furniture")
		{
			var newClip = furniture.duplicateMovieClip("furniture" + i, _root.getNextHighestDepth());

			myLoader.loadClip("furniture/" + this["item_image" + i], newClip.clothingPiece);
		}
		else if(this["item_type" + i] != "furniture") 
		{
			myLoader.loadClip("clothes/" + this["item_image" + i], newClip.clothingPiece);
		}



		newClip._x = this["item_x" + i];
		newClip._y = this["item_y" + i];

		itemsByName[newClip._name] = this["item_user_id" + i];

		newClip.depth = this["item_depth" + i];

		newClip.actualType = this["item_type" + i];

		newClip.itemIsWorn = false;

		/////////////////////////////////////////////
		newClip.cacheAsBitmap = true;
		if (this["item_type" + i] != "furniture")
		{
			newClip._visible = false;
			newClip.targetScale = stackScale;
		}
		/////////////////////////////////////////////

		if (this["item_type" + i] == "furniture")
		{
			newClip.swapDepths(_root.getNextHighestDepth());
			clothes.push(newClip);

			newClip.itemType = "furniture";
			newClip.depthType = "furniture";

			newClip._xscale = 40;
			newClip._yscale = 40;
		}
		else
		{
			clothes.push(newClip);
			newClip.itemType = "clothing";
			newClip.depthType = "clothing";
		}
	}

 

And this is the code on the button:

on(release)
{
_root.showClothes("furniture");
}//_root.innerCloset

Here's my php code:


<?php

$connect = true;
$session_start = true;

require("functions.php");

if(isset($_GET['worn']))
{
	// Load worn items

	$result = mysql_query("SELECT type FROM dolls WHERE id = " . $_GET["doll_id"]);
	$doll_array = mysql_fetch_assoc($result);

	if($doll_array['type'] == "custom")
	{
		$result = mysql_query("SELECT *, ui.id AS user_item_id FROM user_items AS ui, items AS i WHERE ui.doll_id = " . $_GET['doll_id'] . " AND ui.item_id = i.id") or die(mysql_error());
		//$jewelry_result = mysql_query("SELECT *, uj.id AS user_item_id FROM user_jewelry AS uj WHERE uj.doll_id = " . $_GET['doll_id']) or die(mysql_error());

		//$jewelry_result = mysql_query("SELECT *, uj.id AS user_item_id FROM user_jewelry AS uj WHERE ) or die(mysql_error());

		$jewelry_result = mysql_query("
		SELECT
			uj.id,
			uj.id AS user_item_id,
			uj.user_id,
			uj.template_id,
			uj.x,
			uj.y,
			uj.doll_id,
			uj.depth,
			jt.type
		FROM
			user_jewelry AS uj,
			jewelry_templates AS jt
		WHERE
			uj.doll_id = " . $_GET['doll_id'] . " AND
			jt.id = uj.template_id");
	}
	else
	{
		$result = mysql_query("SELECT *, ui.id AS user_item_id FROM user_celeb_items AS ui, items AS i WHERE ui.doll_id = " . $_GET['doll_id'] . " AND ui.item_id = i.id");
	}
}
else
{
	// Load unworn items
         $result = mysql_query("SELECT type FROM items WHERE id = " . $_GET["doll_id"]);
	$result = mysql_query("SELECT type FROM dolls WHERE id = " . $_GET["doll_id"]);
	$doll_array = mysql_fetch_assoc($result);

	if($doll_array['type'] == "custom")
	{
		$result = mysql_query("SELECT *, ui.id AS user_item_id FROM user_items AS ui, items AS i WHERE ui.user_id = " . $_GET['id'] . " AND ui.doll_id = 0 AND ui.item_id = i.id");
		//$jewelry_result = mysql_query("SELECT *, uj.id AS user_item_id FROM user_jewelry AS uj WHERE uj.user_id = " . $_GET['id'] . " AND uj.doll_id = 0") or die(mysql_error());

		$jewelry_result = mysql_query("
		SELECT
			uj.id,
			uj.id AS user_item_id,
			uj.user_id,
			uj.template_id,
			uj.x,
			uj.y,
			uj.doll_id,
			uj.depth,
			jt.type
		FROM
			user_jewelry AS uj,
			jewelry_templates AS jt
		WHERE
			uj.user_id = " . $_GET['id'] . " AND
			uj.doll_id = 0 AND
			jt.id = uj.template_id");
	}
	// No unworn clothes for celebs
}
    
if(mysql_num_rows($result) > 0)
{
	print("status=success");

	print("&items=" . mysql_num_rows($result));

	$counter = 0;
	while($array = mysql_fetch_assoc($result))
	{
		print("&item_id" . $counter . "=" . $array['id']);
		print("&item_user_id" . $counter . "=" . $array['user_item_id']);
		print("&item_type" . $counter . "=" . $array['type']);
		print("&item_name" . $counter . "=" . $array['name']);
		print("&item_desc" . $counter . "=" . $array['description']);
		print("&item_price" . $counter . "=" . $array['price']);
		print("&item_image" . $counter . "=" . $array['image']);
		print("&item_x" . $counter . "=" . $array['x']);
		print("&item_y" . $counter . "=" . $array['y']);
		print("&item_depth" . $counter . "=" . $array['depth']);
            print("&store_time". $counter."=".$array['store']);
		$counter++;
	}
}

if($doll_array['type'] == "custom")
{
	if(mysql_num_rows($jewelry_result) > 0)
	{
		print("&jewelry=" . mysql_num_rows($jewelry_result));

		$counter = 0;
		while($array = mysql_fetch_assoc($jewelry_result))
		{
			print("&jewelry_id" . $counter . "=" . $array['id']);
			print("&jewelry_template" . $counter . "=" . $array['template_id']);
			print("&jewelry_x" . $counter . "=" . $array['x']);
			print("&jewelry_y" . $counter . "=" . $array['y']);
			print("&jewelry_type" . $counter . "=" . $array['type']);
			print("&jewelry_depth" . $counter . "=" . $array['depth']);

			$counter++;
		}
	}
}


?>

 

Here's my tables:

 

id type itemType name description store price image sponsor_id sold position_x position_y

Edit Delete 38 top   gray_top1   tops 100 gray_top1.swf 0 80 365 133

Edit Delete 39 dress   turquoise_dress2   dress 300 turquoise_dress2.swf 0 9 0 0

Edit Delete 40 dress   dress3   dress 500 dress3.swf 0 5 0 0

Edit Delete 95 dress   dress5   dress 425 dress5.swf 0 8 0 0

Edit Delete 96 full   complete9   full 350 complete9.swf 0 7 0 0

Edit Delete 97 dress   dress6   dress 100 dress6.swf 0 6 0 0

Edit Delete 98 full   complete8   full 400 complete8.swf 0 17 0 0

Edit Delete 99 dress   tan_dress1   dress 100 tan_dress1.swf 0 18 0 0

Edit Delete 100 full   complete7   full 450 complete7.swf 0 6 0 0

Edit Delete 101 dress   black_dress3   dress 700 black_dress3.swf 0 8 0 0

Edit Delete 102 dress   black_dress4   dress 750 black_dress4.swf 0 4 0 0

Edit Delete 103 full   complete5   full 300 complete5.swf 0 6 0 0

Edit Delete 104 dress   black_dress5   dress 800 black_dress5.swf 0 3 0 0

Edit Delete 105 dress   purple_dress2   dress 100 purple_dress2.swf 0 11 0 0

Edit Delete 106 dress   brown_dress1   dress 700 brown_dress1.swf 0 9 0 0

Edit Delete 107 full   complete6   full 400 complete6.swf 0 6 0 0

Edit Delete 108 dress   brown_dress2   dress 600 brown_dress2.swf 0 4 0 0

Edit Delete 109 full   complete3   full 325 complete3.swf 0 6 0 0

Edit Delete 110 dress   brown_dress3   dress 500 brown_dress3.swf 0 5 0 0

Edit Delete 111 full   black_complete1   full 600 black_complete1.swf 0 6 0 0

Edit Delete 112 full   complete4   full 200 complete4.swf 0 6 0 0

Edit Delete 113 dress   gold_dress1   dress 100 gold_dress1.swf 0 19 0 0

Edit Delete 114 dress   dress4   dress 400 dress4.swf 0 7 0 0

Edit Delete 130 furniture   WingArmChair_side     300 WingArmChair_side.png 0 0 0 0

Edit Delete 131 furniture   Dresser_side     100 Dresser_side.png 0 0 0 0

Edit Delete 132 furniture   Wardrobe_front   furniture 500 Wardrobe_front.png 0 12 0 0

Edit Delete 133 furniture   TableRoundGlass_front   furniture 100 TableRoundGlass_front.png 0 55 0 0

Edit Delete 134 furniture   RoundLounge_front   furniture 100 RoundLounge_front.png 0 43 0 0

Edit Delete 135 furniture   WingArmChair_front   furniture 300 WingArmChair_front.png 0 12 0 0

Edit Delete 136 furniture   Wardrobe_side     500 Wardrobe_side.png 0 0 0

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.