<?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>PHP Tutorials By Kloplop321 &#187; guide</title>
	<atom:link href="http://kloplop321.com/php-tutorials/index.php/tag/guide/feed/" rel="self" type="application/rss+xml" />
	<link>http://kloplop321.com/php-tutorials</link>
	<description>PHP video tutorials, for everyone.</description>
	<lastBuildDate>Sun, 20 Mar 2011 19:03:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>MySQL and PHPMyAdmin Introduction with PHP 07: A basic Guestbook</title>
		<link>http://kloplop321.com/php-tutorials/index.php/2010/02/15/mysql-and-phpmyadmin-introduction-with-php-07-a-basic-guestbook/</link>
		<comments>http://kloplop321.com/php-tutorials/index.php/2010/02/15/mysql-and-phpmyadmin-introduction-with-php-07-a-basic-guestbook/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 16:05:36 +0000</pubDate>
		<dc:creator>Kloplop321</dc:creator>
				<category><![CDATA[Insert]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tutorials]]></category>
		<category><![CDATA[PHPMyAdmin]]></category>
		<category><![CDATA[Select]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[guestbook]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://kloplop321.com/php-tutorials/?p=183</guid>
		<description><![CDATA[This is pretty much a basic &#8220;How to&#8221; for making a very basic guestbook that uses a database instead of text. I go over everything from making the database to the table, the html form and actual posting. If you watch this video you will pretty much see the basic idea of what a guestbook [...]]]></description>
			<content:encoded><![CDATA[<p>This is pretty much a basic &#8220;How to&#8221; for making a very basic guestbook that uses a database instead of text. I go over everything from making the database to the table, the html form and actual posting.  If you watch this video you will pretty much see the basic idea of what a guestbook is, how they work, and how to make a basic one yourself.</p>
<p>This video has two parts, so to understand fully, please watch both.</p>
<p><object type="application/x-shockwave-flash" style="width: 800px; height: 480px;" data="http://www.youtube.com/v/JBGC1CUB13A&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6"><param name="movie" value="http://www.youtube.com/v/JBGC1CUB13A&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param></object><br />
Part 2 and the source after the jump<br />
<span id="more-183"></span></p>
<p><object type="application/x-shockwave-flash" style="width: 800px; height: 480px;" data="http://www.youtube.com/v/4wJRZK_6HKo&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6"><param name="movie" value="http://www.youtube.com/v/4wJRZK_6HKo&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param></object></p>
<pre><code><span class="webhtml1-specialphpmarker">&lt;?php
</span><span class="webhtml1-specialphpvariableprefix">$link</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">mysql_connect</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpstring">'localhost'</span><span class="webhtml1-phpsymbol">, </span><span class="webhtml1-phpstring">'phpuser'</span><span class="webhtml1-phpsymbol">, </span><span class="webhtml1-phpstring">'phppass'</span><span class="webhtml1-phpsymbol">);
</span><span class="webhtml1-phpkeyword">if</span><span class="webhtml1-phpwhitespace"> (!</span><span class="webhtml1-specialphpvariableprefix">$link</span><span class="webhtml1-phpsymbol">) {
    </span><span class="webhtml1-phpkeyword">die</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpstring">'Not connected : '</span><span class="webhtml1-phpwhitespace"> . </span><span class="webhtml1-phpfunction">mysql_error</span><span class="webhtml1-phpsymbol">());
}</span><span class="webhtml1-phpkeyword">else</span><span class="webhtml1-phpsymbol">{
    </span><span class="webhtml1-phpcomment">//echo &quot;I am connected. &quot;;
</span><span class="webhtml1-phpsymbol">}

</span><span class="webhtml1-phpcomment">// make foo the current db
</span><span class="webhtml1-specialphpvariableprefix">$db_selected</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">mysql_select_db</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpstring">'guestbook'</span><span class="webhtml1-phpsymbol">, </span><span class="webhtml1-specialphpvariableprefix">$link</span><span class="webhtml1-phpsymbol">);
</span><span class="webhtml1-phpkeyword">if</span><span class="webhtml1-phpwhitespace"> (!</span><span class="webhtml1-specialphpvariableprefix">$db_selected</span><span class="webhtml1-phpsymbol">) {
    </span><span class="webhtml1-phpkeyword">die</span><span class="webhtml1-phpwhitespace"> (</span><span class="webhtml1-phpstring">'Can</span><span class="webhtml1-phpstringspecial">\'</span><span class="webhtml1-phpstring">t use guestbook DB : '</span><span class="webhtml1-phpwhitespace"> . </span><span class="webhtml1-phpfunction">mysql_error</span><span class="webhtml1-phpsymbol">());
}
</span><span class="webhtml1-specialphpvariableprefix">$name</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">trim</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$_REQUEST</span><span class="webhtml1-phpsymbol">[</span><span class="webhtml1-phpstring">'name'</span><span class="webhtml1-phpsymbol">]);
</span><span class="webhtml1-specialphpvariableprefix">$comment</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">trim</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$_REQUEST</span><span class="webhtml1-phpsymbol">[</span><span class="webhtml1-phpstring">'comment'</span><span class="webhtml1-phpsymbol">]);
</span><span class="webhtml1-phpkeyword">if</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpfunction">strlen</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$name</span><span class="webhtml1-phpsymbol">)&gt; </span><span class="webhtml1-phpnumber">0</span><span class="webhtml1-phpsymbol">){
    </span><span class="webhtml1-phpkeyword">if</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpfunction">strlen</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$comment</span><span class="webhtml1-phpsymbol">)&gt; </span><span class="webhtml1-phpnumber">0</span><span class="webhtml1-phpsymbol">){
        </span><span class="webhtml1-specialphpvariableprefix">$name</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">mysql_real_escape_string</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$name</span><span class="webhtml1-phpsymbol">);
        </span><span class="webhtml1-specialphpvariableprefix">$comment</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">mysql_real_escape_string</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$comment</span><span class="webhtml1-phpsymbol">);

        </span><span class="webhtml1-specialphpvariableprefix">$sql</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpstring">&quot;INSERT INTO `guestbook`.`entries` (
`ID` ,
`name` ,
`date` ,
`comment`
)
VALUES (
NULL , '</span><span class="webhtml1-phpstringspecial">$name</span><span class="webhtml1-phpstring">', UNIX_TIMESTAMP( ) , '</span><span class="webhtml1-phpstringspecial">$comment</span><span class="webhtml1-phpstring">'
);&quot;</span><span class="webhtml1-phpsymbol">;
</span><span class="webhtml1-phpfunction">mysql_query</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$sql</span><span class="webhtml1-phpsymbol">);
    }</span><span class="webhtml1-phpkeyword">else</span><span class="webhtml1-phpsymbol">{
        </span><span class="webhtml1-phpkeyword">echo</span><span class="webhtml1-phpwhitespace"> </span><span class="webhtml1-phpstring">&quot;You did not put in a comment.&quot;</span><span class="webhtml1-phpsymbol">;
    }
}</span><span class="webhtml1-phpkeyword">else</span><span class="webhtml1-phpsymbol">{
    </span><span class="webhtml1-phpkeyword">if</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-phpfunction">strlen</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$comment</span><span class="webhtml1-phpsymbol">)&gt; </span><span class="webhtml1-phpnumber">0</span><span class="webhtml1-phpsymbol">){
        </span><span class="webhtml1-phpkeyword">echo</span><span class="webhtml1-phpwhitespace"> </span><span class="webhtml1-phpstring">&quot;you got a comment, but not a name;&quot;</span><span class="webhtml1-phpsymbol">;
    }
}
</span><span class="webhtml1-specialphpvariableprefix">$sql</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpstring">&quot;SELECT *
FROM `entries` ORDER BY `ID` DESC
LIMIT 3&quot;</span><span class="webhtml1-phpsymbol">;
</span><span class="webhtml1-specialphpvariableprefix">$result</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">mysql_query</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$sql</span><span class="webhtml1-phpsymbol">);
</span><span class="webhtml1-phpkeyword">while</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$row</span><span class="webhtml1-phpwhitespace"> = </span><span class="webhtml1-phpfunction">mysql_fetch_array</span><span class="webhtml1-phpsymbol">(</span><span class="webhtml1-specialphpvariableprefix">$result</span><span class="webhtml1-phpsymbol">)){
    </span><span class="webhtml1-phpkeyword">echo</span><span class="webhtml1-phpwhitespace"> </span><span class="webhtml1-specialphpvariableprefix">$row</span><span class="webhtml1-phpsymbol">[</span><span class="webhtml1-phpstring">'name'</span><span class="webhtml1-phpsymbol">].</span><span class="webhtml1-phpstring">&quot; Said: &lt;blockquote&gt;&quot;</span><span class="webhtml1-phpsymbol">.</span><span class="webhtml1-specialphpvariableprefix">$row</span><span class="webhtml1-phpsymbol">[</span><span class="webhtml1-phpstring">'comment'</span><span class="webhtml1-phpsymbol">].</span><span class="webhtml1-phpstring">&quot;&lt;/blockquote&gt;&lt;br /&gt;&quot;</span><span class="webhtml1-phpsymbol">;
}
</span><span class="webhtml1-specialphpmarker">?&gt;
</span><span class="webhtml1-mltag">&lt;</span><span class="webhtml1-mltagname">form</span><span class="webhtml1-mlwhitespace"> </span><span class="webhtml1-mlkey">action</span><span class="webhtml1-mlsymbol">=&quot;?&quot; </span><span class="webhtml1-mlkey">method</span><span class="webhtml1-mlsymbol">=&quot;post&quot;</span><span class="webhtml1-mltag">&gt;
</span><span class="webhtml1-mltext">Name:
</span><span class="webhtml1-mltag">&lt;</span><span class="webhtml1-mltagname">input</span><span class="webhtml1-mlwhitespace"> </span><span class="webhtml1-mlkey">type</span><span class="webhtml1-mlsymbol">=&quot;text&quot; </span><span class="webhtml1-mlkey">name</span><span class="webhtml1-mlsymbol">=&quot;name&quot; </span><span class="webhtml1-mltag">/&gt;&lt;</span><span class="webhtml1-mltagname">br</span><span class="webhtml1-mlwhitespace"> </span><span class="webhtml1-mltag">/&gt;
</span><span class="webhtml1-mltext">Comment: </span><span class="webhtml1-mltag">&lt;</span><span class="webhtml1-mltagname">br</span><span class="webhtml1-mlwhitespace"> </span><span class="webhtml1-mltag">/&gt;
&lt;</span><span class="webhtml1-mltagname">textarea</span><span class="webhtml1-mlwhitespace"> </span><span class="webhtml1-mlkey">name</span><span class="webhtml1-mlsymbol">=&quot;comment&quot;</span><span class="webhtml1-mltag">&gt;&lt;/</span><span class="webhtml1-mltagname">textarea</span><span class="webhtml1-mltag">&gt;&lt;</span><span class="webhtml1-mltagname">br</span><span class="webhtml1-mlwhitespace"> </span><span class="webhtml1-mltag">/&gt;
&lt;</span><span class="webhtml1-mltagname">input</span><span class="webhtml1-mlwhitespace"> </span><span class="webhtml1-mlkey">type</span><span class="webhtml1-mlsymbol">=&quot;submit&quot; </span><span class="webhtml1-mlkey">value</span><span class="webhtml1-mlsymbol">=&quot;Submit&quot; </span><span class="webhtml1-mltag">/&gt;
&lt;/</span><span class="webhtml1-mltagname">form</span><span class="webhtml1-mltag">&gt;</span><span class="webhtml1-mlwhitespace">
</span></code></pre>
]]></content:encoded>
			<wfw:commentRss>http://kloplop321.com/php-tutorials/index.php/2010/02/15/mysql-and-phpmyadmin-introduction-with-php-07-a-basic-guestbook/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

