<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>geforcy dot net</title>
	<atom:link href="http://www.geforcy.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geforcy.net</link>
	<description>webapps, tutorials, marketing seo, social media and games</description>
	<lastBuildDate>Fri, 22 Jan 2010 09:58:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>posterous experimenting</title>
		<link>http://www.geforcy.net/uncategorized/posterous-experimenting/</link>
		<comments>http://www.geforcy.net/uncategorized/posterous-experimenting/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 09:58:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.geforcy.net/uncategorized/posterous-experimenting/</guid>
		<description><![CDATA[
I wonder, how do I get pictures and text in 1 post? Let&#39;s give it a try through my gmail&#8230;

  Posted via email   from Daan&#8217;s posterous  



Related posts:posterous compatible geforcy.net



Related posts:<ol><li><a href='http://www.geforcy.net/uncategorized/posterous-compatible-geforcy-net/' rel='bookmark' title='Permanent Link: posterous compatible geforcy.net'>posterous compatible geforcy.net</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'><img src="http://posterous.com/getfile/files.posterous.com/geforcy/Y5hziR1WgtgGlWIuOvjrnUhoV76HmL2uOxIpjrNLbALHWn7OGbL41f3y2fas/teamfoto-nederland.jpg" width="500" height="300" title="posterous experimenting" alt="teamfoto nederland posterous experimenting" />
<p>I wonder, how do I get pictures and text in 1 post? Let&#39;s give it a try through my gmail&#8230;
<p /></p>
<p style="font-size: 10px;">  <a href="http://posterous.com">Posted via email</a>   from <a href="http://geforcy.posterous.com/posterous-experimenting">Daan&#8217;s posterous</a>  </p>
</p></div>


<p>Related posts:<ol><li><a href='http://www.geforcy.net/uncategorized/posterous-compatible-geforcy-net/' rel='bookmark' title='Permanent Link: posterous compatible geforcy.net'>posterous compatible geforcy.net</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.geforcy.net/uncategorized/posterous-experimenting/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>posterous compatible geforcy.net</title>
		<link>http://www.geforcy.net/uncategorized/posterous-compatible-geforcy-net/</link>
		<comments>http://www.geforcy.net/uncategorized/posterous-compatible-geforcy-net/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 09:10:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.geforcy.net/uncategorized/posterous-compatible-geforcy-net/</guid>
		<description><![CDATA[
jeeeh! posterous works with geforcy.net. Every post I write with posterous will be shown on my wordpress blog!
  Posted via web   from Daan&#8217;s posterous  



Related posts:posterous experimenting



Related posts:<ol><li><a href='http://www.geforcy.net/uncategorized/posterous-experimenting/' rel='bookmark' title='Permanent Link: posterous experimenting'>posterous experimenting</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'>
<p>jeeeh! posterous works with geforcy.net. Every post I write with posterous will be shown on my wordpress blog!</p>
<p style="font-size: 10px;">  <a href="http://posterous.com">Posted via web</a>   from <a href="http://geforcy.posterous.com/posterous-compatible-geforcynet">Daan&#8217;s posterous</a>  </p>
</p></div>


<p>Related posts:<ol><li><a href='http://www.geforcy.net/uncategorized/posterous-experimenting/' rel='bookmark' title='Permanent Link: posterous experimenting'>posterous experimenting</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.geforcy.net/uncategorized/posterous-compatible-geforcy-net/feed/</wfw:commentRss>
		<slash:comments>375</slash:comments>
		</item>
		<item>
		<title>Simple PHP MySQL Shopping cart &#8211; PART 2</title>
		<link>http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-2/</link>
		<comments>http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-2/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 11:23:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Tutorials]]></category>

		<guid isPermaLink="false">http://www.geforcy.net/?p=73</guid>
		<description><![CDATA[This is part 2 of the shopping cart. Making the cart.php  and list.php.


Related posts:<ol><li><a href='http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-1/' rel='bookmark' title='Permanent Link: Simple PHP MySQL Shopping cart &#8211; PART 1'>Simple PHP MySQL Shopping cart &#8211; PART 1</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>First off all we will make the list.php. This file shows the items from the database in a list and a link to add the item to the shopping cart.</p>
<p>list.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'db.php'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'cart.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$id_session</span> <span style="color: #339933;">=</span> <span style="color: #990000;">session_id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select * from items&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Shop items&lt;br&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'- - - - -&lt;br&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;itemName&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' - '</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;itemDesc&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; &lt;a href='cart.php?action=add_item&amp;id=&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;itemId&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;Add Item&lt;/a&gt;&lt;br&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br&gt; Items in basket&lt;br&gt;- - - - -&lt;br&gt;'</span><span style="color: #339933;">;</span>
ShowCart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>At the bottom you find the call to ShowCart() function, which is from the cart.php where all the functions of the shopping cart are held.</p>
<p>Now I will show the shopping cart functions which handles the items, it contains functions for adding, updating and showing the cart.</p>
<p>cart.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'db.php'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//database config and connection</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//the switch gets the variables from the url with the corresponding case</span>
<span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//add item from url variable</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;add_item&quot;</span><span style="color: #339933;">:</span>
        AddProduct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ShowCart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">//remove item from cart (not implemented yet!)</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">&quot;remove_item&quot;</span><span style="color: #339933;">:</span>
        RemoveItem<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        ShowCart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//function add product to cart</span>
<span style="color: #000000; font-weight: bold;">function</span> AddProduct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$itemId</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$id_session</span> <span style="color: #339933;">=</span> <span style="color: #990000;">session_id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;select count(*) from cart where sessionId = '&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id_session</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;' and itemId = <span style="color: #006699; font-weight: bold;">$itemId</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$numRows</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$numRows</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//This item doesn't exist in the users cart,</span>
        <span style="color: #666666; font-style: italic;">//we will add it with an insert query</span>
        <span style="color: #339933;">@</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;insert into cart(sessionId, itemId, qty) values('&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id_session</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;', <span style="color: #006699; font-weight: bold;">$itemId</span>, 1)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: list.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//This item already exists in the users cart,</span>
        <span style="color: #666666; font-style: italic;">//we will update it instead</span>
        UpdateProduct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$itemId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//function update product +1 if product is already in cart </span>
<span style="color: #000000; font-weight: bold;">function</span> UpdateProduct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$itemId</span><span style="color: #339933;">,</span> <span style="color: #000088;">$qty</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$id_session</span> <span style="color: #339933;">=</span> <span style="color: #990000;">session_id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #339933;">@</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;update cart set qty = qty + 1 where sessionId = '&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id_session</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;' and itemId = <span style="color: #006699; font-weight: bold;">$itemId</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: list.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//select current user shopping cart and get total</span>
<span style="color: #000000; font-weight: bold;">function</span> ShowCart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$id_session</span> <span style="color: #339933;">=</span> <span style="color: #990000;">session_id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$totalCost</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT *
            FROM cart
            INNER JOIN items
            ON cart.itemId = items.itemId
            WHERE cart.sessionId = '&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id_session</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//open the table and print a header row</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'itemName'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' - '</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'itemDesc'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'itemPrice'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//multiplay quantity and itemprice to get total of 1 product all together</span>
        <span style="color: #000088;">$totalCost</span> <span style="color: #339933;">+=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;qty&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;itemPrice&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Total: &quot;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">//format of the totalcost 2 decimals and overall total</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$totalCost</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>And the result!<br />
<a href="http://www.geforcy.net/wp-content/uploads/2009/12/resultssc.png"><img src="http://www.geforcy.net/wp-content/uploads/2009/12/resultssc.png" alt="resultssc Simple PHP MySQL Shopping cart   PART 2" title="resultssc" width="327" height="197" class="aligncenter size-full wp-image-77" /></a></p>
<p>I hope you understand most of it. If not, please post a comment or send me an email. Comments are welcome as it also helps other users to understand it better.</p>
<p>The source can be downloaded <a href="http://geforcy.net/simplephpmysqlshoppingcart.zip">here</a>.</p>


<p>Related posts:<ol><li><a href='http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-1/' rel='bookmark' title='Permanent Link: Simple PHP MySQL Shopping cart &#8211; PART 1'>Simple PHP MySQL Shopping cart &#8211; PART 1</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-2/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Simple PHP MySQL Shopping cart &#8211; PART 1</title>
		<link>http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-1/</link>
		<comments>http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-1/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 11:23:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Tutorials]]></category>

		<guid isPermaLink="false">http://www.geforcy.net/?p=62</guid>
		<description><![CDATA[Hello everyone, this is my first tutorial ever written, a very simple and basic shopping cart script made in PHP and MySQL. This tutorial I have made for understanding the basics of making a shopping cart in PHP and MySQL.


Related posts:<ol><li><a href='http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-2/' rel='bookmark' title='Permanent Link: Simple PHP MySQL Shopping cart &#8211; PART 2'>Simple PHP MySQL Shopping cart &#8211; PART 2</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>First of all we need to make a database with some information in it. The MYSQL query is as follow:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #CC0099;">--</span>
<span style="color: #808080; font-style: italic;">-- Table structure for table `cart`</span>
<span style="color: #CC0099;">--</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`cart`</span> <span style="color: #FF00FF;">&#40;</span>
  <span style="color: #008000;">`cartId`</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">11</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`sessionId`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">50</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`itemId`</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">11</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`qty`</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">11</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`cartId`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
  <span style="color: #FF9900; font-weight: bold;">UNIQUE</span> <span style="color: #990099; font-weight: bold;">KEY</span> <span style="color: #008000;">`id`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`cartId`</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ENGINE</span><span style="color: #CC0099;">=</span>MyISAM  <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF9900; font-weight: bold;">CHARSET</span><span style="color: #CC0099;">=</span>latin1 <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #CC0099;">=</span><span style="color: #008080;">15</span> <span style="color: #000033;">;</span>
&nbsp;
<span style="color: #CC0099;">--</span>
<span style="color: #808080; font-style: italic;">-- Dumping data for table `cart`</span>
<span style="color: #CC0099;">--</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`cart`</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">11</span><span style="color: #000033;">,</span> <span style="color: #008000;">'6066bf574942638990435126fb5154c1'</span><span style="color: #000033;">,</span> <span style="color: #008080;">1</span><span style="color: #000033;">,</span> <span style="color: #008080;">10</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`cart`</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">12</span><span style="color: #000033;">,</span> <span style="color: #008000;">'6066bf574942638990435126fb5154c1'</span><span style="color: #000033;">,</span> <span style="color: #008080;">2</span><span style="color: #000033;">,</span> <span style="color: #008080;">26</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`cart`</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">13</span><span style="color: #000033;">,</span> <span style="color: #008000;">'16fea7056e1770e1fe37e5b13ffc8cf6'</span><span style="color: #000033;">,</span> <span style="color: #008080;">1</span><span style="color: #000033;">,</span> <span style="color: #008080;">19</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`cart`</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">14</span><span style="color: #000033;">,</span> <span style="color: #008000;">'16fea7056e1770e1fe37e5b13ffc8cf6'</span><span style="color: #000033;">,</span> <span style="color: #008080;">2</span><span style="color: #000033;">,</span> <span style="color: #008080;">20</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- --------------------------------------------------------</span>
&nbsp;
<span style="color: #CC0099;">--</span>
<span style="color: #808080; font-style: italic;">-- Table structure for table `items`</span>
<span style="color: #CC0099;">--</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`items`</span> <span style="color: #FF00FF;">&#40;</span>
  <span style="color: #008000;">`itemId`</span> <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">11</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`itemName`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">50</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`itemDesc`</span> <span style="color: #999900; font-weight: bold;">varchar</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">250</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #008000;">`itemPrice`</span> <span style="color: #999900; font-weight: bold;">decimal</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">4</span><span style="color: #000033;">,</span><span style="color: #008080;">2</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><span style="color: #000033;">,</span>
  <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`itemId`</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span>
  <span style="color: #FF9900; font-weight: bold;">UNIQUE</span> <span style="color: #990099; font-weight: bold;">KEY</span> <span style="color: #008000;">`id`</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">`itemId`</span><span style="color: #FF00FF;">&#41;</span>
<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ENGINE</span><span style="color: #CC0099;">=</span>MyISAM  <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #FF9900; font-weight: bold;">CHARSET</span><span style="color: #CC0099;">=</span>latin1 <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #CC0099;">=</span><span style="color: #008080;">3</span> <span style="color: #000033;">;</span>
&nbsp;
<span style="color: #CC0099;">--</span>
<span style="color: #808080; font-style: italic;">-- Dumping data for table `items`</span>
<span style="color: #CC0099;">--</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`items`</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">1</span><span style="color: #000033;">,</span> <span style="color: #008000;">'Skeelers'</span><span style="color: #000033;">,</span> <span style="color: #008000;">'Like ice skating but different'</span><span style="color: #000033;">,</span> <span style="color: #008080;">9.95</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">INSERT</span> <span style="color: #990099; font-weight: bold;">INTO</span> <span style="color: #008000;">`items`</span> <span style="color: #990099; font-weight: bold;">VALUES</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">2</span><span style="color: #000033;">,</span> <span style="color: #008000;">'Pencil'</span><span style="color: #000033;">,</span> <span style="color: #008000;">'To write stuff'</span><span style="color: #000033;">,</span> <span style="color: #008080;">1.45</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span></pre></div></div>

<p>As you can see I have put some products in the items table, we will show these items in list.php where we find all the products and add them to the shopping cart.</p>
<p><a href="http://www.geforcy.net/wp-content/uploads/2009/12/sqlitems.png"><img class="alignnone size-full wp-image-68" title="sqlitems" src="http://www.geforcy.net/wp-content/uploads/2009/12/sqlitems.png" alt="sqlitems Simple PHP MySQL Shopping cart   PART 1" width="483" height="68" /></a></p>
<p>Now we begin to start a session() and a database connection. We call the this file db.php.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #990000;">session_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//the database variables, fill in your own if you are not using mamp</span>
<span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$dbname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;simplephpshoppingcart&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span><span style="color: #000088;">$user</span><span style="color: #339933;">,</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Database error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>So far it is pretty simple. In part 2 I will show the list.php and cart.php to complete the very basic shop. Which we will improve by time and my hopefully my tutorial skills will be better by that time.</p>
<p>Go to Simple PHP MySQL Shopping Cart &#8211; Part 2.</p>


<p>Related posts:<ol><li><a href='http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-2/' rel='bookmark' title='Permanent Link: Simple PHP MySQL Shopping cart &#8211; PART 2'>Simple PHP MySQL Shopping cart &#8211; PART 2</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.geforcy.net/web-tutorials/simple-php-mysql-shopping-cart-part-1/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>SEO for your blog</title>
		<link>http://www.geforcy.net/seo/seo-for-your-blog/</link>
		<comments>http://www.geforcy.net/seo/seo-for-your-blog/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 09:21:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.geforcy.net/?p=19</guid>
		<description><![CDATA[The following article on yoast.com is very interesting for all the bloggers. Take a look at http://yoast.com/articles/wordpress-seo/ and generate more traffic to your website.


No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #000000; font-weight: bold;">function</span> foo<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Hello World!<span style="color: #000099; font-weight: bold;">\\</span>n&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>



<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.geforcy.net/seo/seo-for-your-blog/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Welcome to geforcy.net</title>
		<link>http://www.geforcy.net/uncategorized/welcome-to-geforcy-net/</link>
		<comments>http://www.geforcy.net/uncategorized/welcome-to-geforcy-net/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 08:34:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.geforcy.net/?p=3</guid>
		<description><![CDATA[
This is the first article ever on geforcy.net! It will be all about webapps webtutorials and more&#8230;


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.geforcy.net/wp-content/uploads/2009/11/cow_rev.jpg"><img class="alignnone size-full wp-image-27" title="cow_rev" src="http://www.geforcy.net/wp-content/uploads/2009/11/cow_rev.jpg" alt="cow rev Welcome to geforcy.net" width="500" height="370" /></a></p>
<p>This is the first article ever on geforcy.net! It will be all about webapps webtutorials and more&#8230;</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.geforcy.net/uncategorized/welcome-to-geforcy-net/feed/</wfw:commentRss>
		<slash:comments>571</slash:comments>
		</item>
	</channel>
</rss>

