<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using Items (PHP)</title>
	<atom:link href="http://buildingbrowsergames.com/2008/10/16/using-items-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/</link>
	<description>Ever wanted to build a browsergame?</description>
	<lastBuildDate>Wed, 30 Nov 2011 19:42:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Green Magi0</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-617</link>
		<dc:creator>Green Magi0</dc:creator>
		<pubDate>Thu, 23 Oct 2008 09:32:12 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-617</guid>
		<description>I think that&#039;s what you wanted to see, if not, let me know and I&#039;ll get the correct code up. :P&lt;br&gt;&lt;br&gt;I&#039;m kind of a PHP noob, but I want to go to school for it, and become a Webmaster, or possibly just a freelance webdeveloper/ designer soon. I need a job soon, and I love making websites.</description>
		<content:encoded><![CDATA[<p>I think that&#39;s what you wanted to see, if not, let me know and I&#39;ll get the correct code up. <img src='http://buildingbrowsergames.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>I&#39;m kind of a PHP noob, but I want to go to school for it, and become a Webmaster, or possibly just a freelance webdeveloper/ designer soon. I need a job soon, and I love making websites.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Green Magi0</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-616</link>
		<dc:creator>Green Magi0</dc:creator>
		<pubDate>Thu, 23 Oct 2008 09:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-616</guid>
		<description>Example Inventory from database;&lt;br&gt;usedspaces = 11&lt;br&gt;inventory = 12 , 9 , 13 , 3 , 2 , 2 , 9 , 9 , 2 , 2 , 11&lt;br&gt;Each number is an item ID.&lt;br&gt;I&#039;m not good with arrays, so I use the field, &quot;usedspaces,&quot; to tell my functions how many times to repeat the cycles.&lt;br&gt;&lt;br&gt;$query = &quot;SELECT * FROM users WHERE username = &#039;$user&#039;&quot;;&lt;br&gt;$results = mysql_query($query) or die(mysql_error());&lt;br&gt;$row = mysql_fetch_array($results) or die(mysql_error());&lt;br&gt;$invo = $row[&#039;inventory&#039;];&lt;br&gt;$inventory = explode(&quot; , &quot;,$invo);&lt;br&gt;&lt;br&gt;$n = 0;&lt;br&gt;while ($n &lt;= $usedspaces)&lt;br&gt;{&lt;br&gt;$currentitem = $inventory[$n];&lt;br&gt;$query1 = &quot;SELECT * &quot; . &lt;br&gt;		 &quot;FROM items &quot; . &lt;br&gt;		 &quot;WHERE id = &#039;$currentitem&#039;&quot;;&lt;br&gt;$results1 = mysql_query($query1) or die(mysql_error());&lt;br&gt;$row1 = mysql_fetch_array($results1) or die(mysql_error());&lt;br&gt;$name1 = $row1[&#039;name&#039;];&lt;br&gt;$id1 = $currentitem;&lt;br&gt;echo &quot;&lt;td width=90&gt;&lt;center&gt;&lt;b&gt;&lt;font size=&#039;2&#039;&gt;$name1&lt;/font size&gt;&lt;/b&gt;&lt;br&gt;&lt;a href=&#039;viewitem.php?item=$id1&#039; rel=&quot;nofollow&quot;&gt;&lt;img border=0 src=&#039;images/items/$id1.png&#039;&gt;&lt;/a href&gt;&lt;br&gt;&lt;a href=&#039;drop.php?item=$n&#039; onClick=&quot;if ( !confirm (&#039;Are you sure you want to drop $name1?&#039;) ) { return false; }&quot;&gt;&lt;font size=&#039;2&#039;&gt;Drop&lt;/font size&gt;&lt;/a href&gt; / &lt;a href=&#039;use.php?item=$n&#039; rel=&quot;nofollow&quot;&gt;&lt;font size=&#039;2&#039;&gt;Use&lt;/font size&gt;&lt;/a href&gt;&lt;br&gt;&lt;a href=&#039;deposit.php?item=$n&#039; onClick=&quot;if ( !confirm (&#039;Are you sure you want to deposit $name1?&#039;) ) { return false; }&quot;&gt;&lt;font size=&#039;2&#039;&gt;Deposit&lt;/font size&gt;&lt;/a href&gt;&lt;/center&gt;&lt;/td&gt;&quot;;&lt;br&gt;$n++;&lt;br&gt;}&lt;br&gt;&lt;br&gt;I have 5 copies of the code inside the while so that I get 5 items to display per row, then it creates a new row, and repeats until it goes through every item in your inventory.</description>
		<content:encoded><![CDATA[<p>Example Inventory from database;<br />usedspaces = 11<br />inventory = 12 , 9 , 13 , 3 , 2 , 2 , 9 , 9 , 2 , 2 , 11<br />Each number is an item ID.<br />I&#39;m not good with arrays, so I use the field, &#8220;usedspaces,&#8221; to tell my functions how many times to repeat the cycles.</p>
<p>$query = &#8220;SELECT * FROM users WHERE username = &#39;$user&#39;&#8221;;<br />$results = mysql_query($query) or die(mysql_error());<br />$row = mysql_fetch_array($results) or die(mysql_error());<br />$invo = $row[&#39;inventory&#39;];<br />$inventory = explode(&#8221; , &#8220;,$invo);</p>
<p>$n = 0;<br />while ($n &lt;= $usedspaces)<br />{<br />$currentitem = $inventory[$n];<br />$query1 = &#8220;SELECT * &#8221; . <br />		 &#8220;FROM items &#8221; . <br />		 &#8220;WHERE id = &#39;$currentitem&#39;&#8221;;<br />$results1 = mysql_query($query1) or die(mysql_error());<br />$row1 = mysql_fetch_array($results1) or die(mysql_error());<br />$name1 = $row1[&#39;name&#39;];<br />$id1 = $currentitem;<br />echo &#8220;&lt;td width=90&gt;&lt;center&gt;<b>&lt;font size=&#39;2&#39;&gt;$name1&lt;/font size&gt;</b><br /><a href=&#39;viewitem.php?item=$id1&#39; rel="nofollow">&lt;img border=0 src=&#39;images/items/$id1.png&#39;&gt;</a><br />&lt;a href=&#39;drop.php?item=$n&#39; onClick=&#8221;if ( !confirm (&#39;Are you sure you want to drop $name1?&#39;) ) { return false; }&#8221;&gt;&lt;font size=&#39;2&#39;&gt;Drop&lt;/font size&gt; / <a href=&#39;use.php?item=$n&#39; rel="nofollow">&lt;font size=&#39;2&#39;&gt;Use&lt;/font size&gt;</a><br />&lt;a href=&#39;deposit.php?item=$n&#39; onClick=&#8221;if ( !confirm (&#39;Are you sure you want to deposit $name1?&#39;) ) { return false; }&#8221;&gt;&lt;font size=&#39;2&#39;&gt;Deposit&lt;/font size&gt;&lt;/center&gt;&lt;/td&gt;&#8221;;<br />$n++;<br />}</p>
<p>I have 5 copies of the code inside the while so that I get 5 items to display per row, then it creates a new row, and repeats until it goes through every item in your inventory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Green Magi0</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-151</link>
		<dc:creator>Green Magi0</dc:creator>
		<pubDate>Thu, 23 Oct 2008 04:32:12 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-151</guid>
		<description>I&#039;m kind of a PHP noob, but I want to go to school for it, and become a Webmaster, or possibly just a freelance webdeveloper/ designer soon. I need a job soon, and I love making websites.</description>
		<content:encoded><![CDATA[<p>I&#39;m kind of a PHP noob, but I want to go to school for it, and become a Webmaster, or possibly just a freelance webdeveloper/ designer soon. I need a job soon, and I love making websites.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Green Magi0</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-150</link>
		<dc:creator>Green Magi0</dc:creator>
		<pubDate>Thu, 23 Oct 2008 04:28:03 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-150</guid>
		<description>Example Inventory from database;&lt;br&gt;usedspaces = 11&lt;br&gt;inventory = 12 , 9 , 13 , 3 , 2 , 2 , 9 , 9 , 2 , 2 , 11&lt;br&gt;Each number is an item ID.&lt;br&gt;I&#039;m not good with arrays, so I use the field, &quot;usedspaces,&quot; to tell my functions how many times to repeat the cycles.&lt;br&gt;&lt;br&gt;$query = &quot;SELECT * FROM users WHERE username = &#039;$user&#039;&quot;;&lt;br&gt;$results = mysql_query($query) or die(mysql_error());&lt;br&gt;$row = mysql_fetch_array($results) or die(mysql_error());&lt;br&gt;$invo = $row[&#039;inventory&#039;];&lt;br&gt;$inventory = explode(&quot; , &quot;,$invo);&lt;br&gt;&lt;br&gt;$n = 0;&lt;br&gt;while ($n &lt;= $usedspaces)&lt;br&gt;{&lt;br&gt;$currentitem = $inventory[$n];&lt;br&gt;$query1 = &quot;SELECT * &quot; . &lt;br&gt;		 &quot;FROM items &quot; . &lt;br&gt;		 &quot;WHERE id = &#039;$currentitem&#039;&quot;;&lt;br&gt;$results1 = mysql_query($query1) or die(mysql_error());&lt;br&gt;$row1 = mysql_fetch_array($results1) or die(mysql_error());&lt;br&gt;$name1 = $row1[&#039;name&#039;];&lt;br&gt;$id1 = $currentitem;&lt;br&gt;echo &quot;&lt;td width=90&gt;&lt;center&gt;&lt;b&gt;&lt;font size=&#039;2&#039;&gt;$name1&lt;/font size&gt;&lt;/b&gt;&lt;br&gt;&lt;a href=&#039;viewitem.php?item=$id1&#039;&gt;&lt;img border=0 src=&#039;images/items/$id1.png&#039;&gt;&lt;/a href&gt;&lt;br&gt;&lt;a href=&#039;drop.php?item=$n&#039; onClick=&quot;if ( !confirm (&#039;Are you sure you want to drop $name1?&#039;) ) { return false; }&quot;&gt;&lt;font size=&#039;2&#039;&gt;Drop&lt;/font size&gt;&lt;/a href&gt; / &lt;a href=&#039;use.php?item=$n&#039;&gt;&lt;font size=&#039;2&#039;&gt;Use&lt;/font size&gt;&lt;/a href&gt;&lt;br&gt;&lt;a href=&#039;deposit.php?item=$n&#039; onClick=&quot;if ( !confirm (&#039;Are you sure you want to deposit $name1?&#039;) ) { return false; }&quot;&gt;&lt;font size=&#039;2&#039;&gt;Deposit&lt;/font size&gt;&lt;/a href&gt;&lt;/center&gt;&lt;/td&gt;&quot;;&lt;br&gt;$n++;&lt;br&gt;}&lt;br&gt;&lt;br&gt;I have 5 copies of the code inside the while so that I get 5 items to display per row, then it creates a new row, and repeats until it goes through every item in your inventory.</description>
		<content:encoded><![CDATA[<p>Example Inventory from database;<br />usedspaces = 11<br />inventory = 12 , 9 , 13 , 3 , 2 , 2 , 9 , 9 , 2 , 2 , 11<br />Each number is an item ID.<br />I&#39;m not good with arrays, so I use the field, &#8220;usedspaces,&#8221; to tell my functions how many times to repeat the cycles.</p>
<p>$query = &#8220;SELECT * FROM users WHERE username = &#39;$user&#39;&#8221;;<br />$results = mysql_query($query) or die(mysql_error());<br />$row = mysql_fetch_array($results) or die(mysql_error());<br />$invo = $row[&#39;inventory&#39;];<br />$inventory = explode(&#8221; , &#8220;,$invo);</p>
<p>$n = 0;<br />while ($n &lt;= $usedspaces)<br />{<br />$currentitem = $inventory[$n];<br />$query1 = &#8220;SELECT * &#8221; . <br />		 &#8220;FROM items &#8221; . <br />		 &#8220;WHERE id = &#39;$currentitem&#39;&#8221;;<br />$results1 = mysql_query($query1) or die(mysql_error());<br />$row1 = mysql_fetch_array($results1) or die(mysql_error());<br />$name1 = $row1[&#39;name&#39;];<br />$id1 = $currentitem;<br />echo &#8220;&lt;td width=90&gt;&lt;center&gt;<b>&lt;font size=&#39;2&#39;&gt;$name1&lt;/font size&gt;</b><br /><a href=&#39;viewitem.php?item=$id1&#39;>&lt;img border=0 src=&#39;images/items/$id1.png&#39;&gt;</a><br />&lt;a href=&#39;drop.php?item=$n&#39; onClick=&#8221;if ( !confirm (&#39;Are you sure you want to drop $name1?&#39;) ) { return false; }&#8221;&gt;&lt;font size=&#39;2&#39;&gt;Drop&lt;/font size&gt; / <a href=&#39;use.php?item=$n&#39;>&lt;font size=&#39;2&#39;&gt;Use&lt;/font size&gt;</a><br />&lt;a href=&#39;deposit.php?item=$n&#39; onClick=&#8221;if ( !confirm (&#39;Are you sure you want to deposit $name1?&#39;) ) { return false; }&#8221;&gt;&lt;font size=&#39;2&#39;&gt;Deposit&lt;/font size&gt;&lt;/center&gt;&lt;/td&gt;&#8221;;<br />$n++;<br />}</p>
<p>I have 5 copies of the code inside the while so that I get 5 items to display per row, then it creates a new row, and repeats until it goes through every item in your inventory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-149</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Wed, 22 Oct 2008 17:48:16 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-149</guid>
		<description>I think for now just seeing the way that you load a player&#039;s inventory would&lt;br&gt;be good - although if you have ideas on how to improve the other areas of&lt;br&gt;the tutorial as well, please e-mail them to &lt;a href=&quot;mailto:buildingbrowsergames@gmail.com&quot;&gt;buildingbrowsergames@gmail.com&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>I think for now just seeing the way that you load a player&#39;s inventory would<br />be good &#8211; although if you have ideas on how to improve the other areas of<br />the tutorial as well, please e-mail them to <a href="mailto:buildingbrowsergames@gmail.com">buildingbrowsergames@gmail.com</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: greenmagi0</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-148</link>
		<dc:creator>greenmagi0</dc:creator>
		<pubDate>Wed, 22 Oct 2008 16:52:04 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-148</guid>
		<description>What all pieces would you want to see?&lt;br&gt;I have a shop system that builds onto your inventory when you buy items, you can drop items, I have inventory system, also equipment system.</description>
		<content:encoded><![CDATA[<p>What all pieces would you want to see?<br />I have a shop system that builds onto your inventory when you buy items, you can drop items, I have inventory system, also equipment system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-144</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Tue, 21 Oct 2008 18:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-144</guid>
		<description>Hi greenmagi0,&lt;br&gt;That&#039;s probably true - typically the first pass of these tutorials has a bit&lt;br&gt;more code than it needs. Would you care to share your inventory code?</description>
		<content:encoded><![CDATA[<p>Hi greenmagi0,<br />That&#39;s probably true &#8211; typically the first pass of these tutorials has a bit<br />more code than it needs. Would you care to share your inventory code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: greenmagi0</title>
		<link>http://buildingbrowsergames.com/2008/10/16/using-items-php/comment-page-1/#comment-143</link>
		<dc:creator>greenmagi0</dc:creator>
		<pubDate>Tue, 21 Oct 2008 17:13:59 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/?p=488#comment-143</guid>
		<description>It looks like you have more code than necessary. I have a pbbg and my game uses literally 4-5 lines of php to extract and build your inventory from the database, then it uses a while statement, and fills in the variables it got into the html tables.</description>
		<content:encoded><![CDATA[<p>It looks like you have more code than necessary. I have a pbbg and my game uses literally 4-5 lines of php to extract and build your inventory from the database, then it uses a while statement, and fills in the variables it got into the html tables.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

