<?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"
	>

<channel>
	<title>Coding/Rambling.</title>
	<atom:link href="http://betapalace.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://betapalace.com</link>
	<description>Random Ramblings as well as occasional Coding updates and-or snippets.</description>
	<pubDate>Wed, 25 Jun 2008 18:30:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>My first Code snippet</title>
		<link>http://betapalace.com/2008/06/25/my-first-code-snippet/</link>
		<comments>http://betapalace.com/2008/06/25/my-first-code-snippet/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 06:02:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://betapalace.com/?p=4</guid>
		<description><![CDATA[Wow, frankly, I&#8217;m somewhat proud of myself! This is the first day I&#8217;ve had this blog up and this is my second post today! Wow - whoopdi doo, I know. But anyway&#8230;let&#8217;s get on with this little code snippet. Basically, one of my friends was needing a random Testimonial script, so I decided to step [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, frankly, I&#8217;m somewhat proud of myself! This is the first day I&#8217;ve had this blog up and this is my second post today! Wow - whoopdi doo, I know. But anyway&#8230;let&#8217;s get on with this little code snippet. Basically, one of my friends was needing a random Testimonial script, so I decided to step up to the plate and give it a swing. All it really does, is connect to a db, pull the testimonial text from the table, and slap the username in at the end of it. Also - I dropped some CSS in there too, since I just can&#8217;t stand to leave something so plain and boring. I&#8217;ll also show you the Table I created to pull the data from. Here it is:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #339933;">&lt;</span>style type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #666666; font-style: italic;">#box</span>
<span style="color: #009900;">&#123;</span>
	color<span style="color: #339933;">:</span>white<span style="color: #339933;">;</span>
	background<span style="color: #339933;">-</span>color<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">#42308d;</span>
	border<span style="color: #339933;">:</span> 1px lawngreen solid<span style="color: #339933;">;</span>
	width<span style="color: #339933;">:</span><span style="color: #cc66cc;">25</span><span style="color: #339933;">%;</span>
	padding<span style="color: #339933;">:</span>5px<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>style<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;error_reporting&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;E_ALL &amp; ~E_NOTICE&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//Connect to DB</span>
<span style="color: #000033;">$username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'db_username'</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'user_password'</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$db</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'db_name'</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$connect</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$host</span><span style="color: #339933;">,</span><span style="color: #000033;">$username</span><span style="color: #339933;">,</span><span style="color: #000033;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$seldb</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//Query the db</span>
<span style="color: #000033;">$q1</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 * FROM table&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000033;">$rownum</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_numrows</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$q1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//Chooses a random number</span>
<span style="color: #000033;">$num</span> <span style="color: #339933;">=</span> <span style="color: #990000;">Rand</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #000033;">$rownum</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//Based on the random number, gives a quote</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$a1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$q1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000033;">$num</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">case</span> <span style="color: #000033;">$a1</span><span style="color: #009900;">&#91;</span>id<span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span>
<span style="color: #990000;">echo</span> <span style="color: #0000ff;">'&lt;div id=&quot;box&quot;&gt;&lt;font face=&quot;Tahoma&quot;&gt;&quot;
'</span><span style="color: #339933;">.</span><span style="color: #000033;">$a1</span><span style="color: #009900;">&#91;</span>testimonial<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; - '</span><span style="color: #339933;">.</span><span style="color: #000033;">$a1</span><span style="color: #009900;">&#91;</span>username<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Here&#8217;s the SQL:</p>

<div class="wp_syntax"><div class="code"><pre class="sql"><span style="color: #808080; font-style: italic;">-- phpMyAdmin SQL Dump</span>
<span style="color: #808080; font-style: italic;">-- version 2.11.6</span>
<span style="color: #808080; font-style: italic;">-- http://www.phpmyadmin.net</span>
<span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Host: localhost</span>
<span style="color: #808080; font-style: italic;">-- Generation Time: Jun 25, 2008 at 01:50 AM</span>
<span style="color: #808080; font-style: italic;">-- Server version: 5.0.51</span>
<span style="color: #808080; font-style: italic;">-- PHP Version: 5.2.6</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">SET</span> SQL_MODE<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;NO_AUTO_VALUE_ON_ZERO&quot;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Database: `db`</span>
<span style="color: #808080; font-style: italic;">--</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- --------------------------------------------------------</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Table structure for table `table`</span>
<span style="color: #808080; font-style: italic;">--</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`table`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`id`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`username`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`testimonial`</span> text <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #ff0000;">`id`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM  <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1 <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">3</span> ;</pre></div></div>

<p>In order to add testimonials, or whatnot you need to know how to run basic INSERT INTO sql statements, if you don&#8217;t know how to do that, then your next best bet is using phpMyAdmin, which is how I inserted those in.<br />
A working example can be found <a href="http://betapalace.com/test/testimonial.php">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://betapalace.com/2008/06/25/my-first-code-snippet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Intro</title>
		<link>http://betapalace.com/2008/06/24/intro/</link>
		<comments>http://betapalace.com/2008/06/24/intro/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 17:48:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[general]]></category>

		<category><![CDATA[intro]]></category>

		<category><![CDATA[introdution]]></category>

		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://betapalace.com/?p=3</guid>
		<description><![CDATA[Well, I&#8217;m Chris Z and I will be managing the blog here. It will be a hybrid of my own personal ramblings and some coding info mixed in there somewhere. I&#8217;m currently working on an Upload tool called Kleen Upload System, so if I post anything about coding, it will probably be that, although I [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;m Chris Z and I will be managing the blog here. It will be a hybrid of my own personal ramblings and some coding info mixed in there somewhere. I&#8217;m currently working on an Upload tool called Kleen Upload System, so if I post anything about coding, it will probably be that, although I may post some random code snippets if I feel like it. I look forward to actually having some visitors on my site. Let me know what I can improve on.<br />
Until Later,</p>
<p>Chris Z</p>
]]></content:encoded>
			<wfw:commentRss>http://betapalace.com/2008/06/24/intro/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
