<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:ymaps="http://api.maps.yahoo.com/Maps/V2/AnnotatedMaps.xsd">

<channel>
	<title>Tiw Works &#187; Database Design</title>
	<atom:link href="http://tiw.blogginggeek.com/category/database-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://tiw.blogginggeek.com</link>
	<description>something like a portfolio</description>
	<lastBuildDate>Wed, 14 Oct 2009 13:25:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress vs. HomeMade PHP Website</title>
		<link>http://tiw.blogginggeek.com/2009/01/wordpress-vs-homemade-php-website/</link>
		<comments>http://tiw.blogginggeek.com/2009/01/wordpress-vs-homemade-php-website/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 00:08:31 +0000</pubDate>
		<dc:creator>tiw</dc:creator>
				<category><![CDATA[Database Design]]></category>
		<category><![CDATA[Links]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[My Other]]></category>

		<guid isPermaLink="false">http://tiw.blogginggeek.com/?p=205</guid>
		<description><![CDATA[After my graduation in 2005, I started drawing some cartoons -which is nowhere near my favorite cartoon series &#8220;Fox Trot&#8221; or anything like that..- It was just for fun, spending some time while learning some tools.. Anyway, I also wanted to display these cartoons on the internet. But I didn&#8217;t have a WordPress account back [...]]]></description>
			<content:encoded><![CDATA[<p>After my graduation in 2005, I started drawing some cartoons -which is nowhere near my favorite cartoon series &#8220;<a href="http://www.foxtrot.com/" target="_blank">Fox Trot</a>&#8221; or anything like that..- It was just for fun, spending some time while learning some tools.. Anyway, I also wanted to display these cartoons on the internet. But I didn&#8217;t have a WordPress account back then, or didn&#8217;t know about it yet.. So I decided to make my own PHP website in order to display the cartoons dynamically.</p>
<p>Here is the design I made for the database:</p>
<p>2 tables only. Nothing fancy :-)<br />
One for the images &#8220;TBLIMAGE&#8221;, and the other for the subjects &#8220;TBLSUBJECT&#8221;.</p>
<p>Image table has the columns below:</p>
<ul>
<li>imageID: unique id</li>
<li>fileName: name of the file that we will show</li>
<li>subjectID (key for getting the subject name from the subjects table)</li>
<li>filePreTxt: Some text to display just before the image</li>
<li>filePostTxt: Some text to display just after the image</li>
<li>strImageQueue: Within the subject every image has a queue which shows their priority to be shown</li>
</ul>
<div id="attachment_206" class="wp-caption alignnone" style="width: 438px"><a href="http://tiw.blogginggeek.com/wp-content/uploads/2009/01/tableimage.jpg"><img class="size-full wp-image-206" title="tableimage" src="http://tiw.blogginggeek.com/wp-content/uploads/2009/01/tableimage.jpg" alt="TBLIMAGE" width="428" height="139" /></a><p class="wp-caption-text">TBLIMAGE</p></div>
<p>Subject table has the columns below:</p>
<ul>
<li>parentSubjectID</li>
<li>subjectText: The title of the cartoon will use what ever text is in here</li>
<li>strSubjectDate: We will order the cartoon files first according to their subject dates</li>
</ul>
<div id="attachment_207" class="wp-caption alignnone" style="width: 424px"><a href="http://tiw.blogginggeek.com/wp-content/uploads/2009/01/tablesubject.jpg"><img class="size-full wp-image-207" title="tablesubject" src="http://tiw.blogginggeek.com/wp-content/uploads/2009/01/tablesubject.jpg" alt="TBLSUBJECT" width="414" height="118" /></a><p class="wp-caption-text">TBLSUBJECT</p></div>
<p>And here are some parts of the PHP codes, that you may find useful:</p>
<p>Setting up the <a href="http://tiw.blogginggeek.com/wp-content/uploads/2009/01/configphp.txt">configuration file</a> by assigning the dbname, username, password values to their variables respectively:<br />
<code><br />
$dbhost = 'localhost';<br />
$dbuser = 'yourdbusername';<br />
$dbpass = 'yourdbpassword';<br />
$dbname = 'yourdbname';<br />
</code></p>
<p><a href="http://tiw.blogginggeek.com/wp-content/uploads/2009/01/opendbphp.txt">Opening</a> the database connection to work with:<br />
<code><br />
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');<br />
mysql_select_db($dbname);<br />
</code></p>
<p>And finally, defining and running my query:<br />
<code><br />
$query = "SELECT filepretxt, fileposttxt, filename, subjecttext, strimagequeue FROM tblimage, tblsubject  WHERE subjectid = parentsubjectid order by strsubjectdate asc, strimagequeue asc";<br />
$result = mysql_query($query) or die('Error, query failed');<br />
</code></p>
<p>Well, I didn&#8217;t forget to <a href="http://tiw.blogginggeek.com/wp-content/uploads/2009/01/closedbphp.txt" target="_blank">close the database connection</a> of course.<br />
<code><br />
mysql_close($conn);<br />
</code></p>
<p>So, here is my question:<br />
Now that we have a chance to use a powerful and easy to integrate web application like Wordpress, would you rather use it, or make your own PHP Website for displaying your works/cartoons/etc.?<br />
Or lets put it this way:<br />
Which one is better?<br />
<a href="http://whibdatt.blogginggeek.com" target="_blank">Whibdatt [WordPress]</a> or <a href="http://whiblog.blogginggeek.com/" target="_blank">Whibdatt [HomeMade]</a>?</p>
<p>Special thanks to <a href="http://www.w3schools.com/" target="_blank">W3Schools</a> for their nice and explanatory web development tutorials ^^</p>



Share this:


	<a rel="nofollow"  target="_blank" href="mailto:?subject=WordPress%20vs.%20HomeMade%20PHP%20Website&amp;body=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F" title="email"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F&amp;partner=sociable" title="Print"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=WordPress%20vs.%20HomeMade%20PHP%20Website%20-%20http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F" title="Twitter"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F&amp;title=WordPress%20vs.%20HomeMade%20PHP%20Website&amp;annotation=After%20my%20graduation%20in%202005%2C%20I%20started%20drawing%20some%20cartoons%20-which%20is%20nowhere%20near%20my%20favorite%20cartoon%20series%20%22Fox%20Trot%22%20or%20anything%20like%20that..-%20It%20was%20just%20for%20fun%2C%20spending%20some%20time%20while%20learning%20some%20tools..%20Anyway%2C%20I%20also%20wanted%20to%20display%20th" title="Google Bookmarks"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F&amp;title=WordPress%20vs.%20HomeMade%20PHP%20Website" title="Reddit"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F&amp;title=WordPress%20vs.%20HomeMade%20PHP%20Website&amp;notes=After%20my%20graduation%20in%202005%2C%20I%20started%20drawing%20some%20cartoons%20-which%20is%20nowhere%20near%20my%20favorite%20cartoon%20series%20%22Fox%20Trot%22%20or%20anything%20like%20that..-%20It%20was%20just%20for%20fun%2C%20spending%20some%20time%20while%20learning%20some%20tools..%20Anyway%2C%20I%20also%20wanted%20to%20display%20th" title="del.icio.us"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F&amp;title=WordPress%20vs.%20HomeMade%20PHP%20Website&amp;bodytext=After%20my%20graduation%20in%202005%2C%20I%20started%20drawing%20some%20cartoons%20-which%20is%20nowhere%20near%20my%20favorite%20cartoon%20series%20%22Fox%20Trot%22%20or%20anything%20like%20that..-%20It%20was%20just%20for%20fun%2C%20spending%20some%20time%20while%20learning%20some%20tools..%20Anyway%2C%20I%20also%20wanted%20to%20display%20th" title="Digg"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F&amp;title=WordPress%20vs.%20HomeMade%20PHP%20Website" title="DZone"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F" title="Technorati"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Ftiw.blogginggeek.com%2F2009%2F01%2Fwordpress-vs-homemade-php-website%2F&amp;t=WordPress%20vs.%20HomeMade%20PHP%20Website" title="Facebook"><img src="http://tiw.blogginggeek.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://tiw.blogginggeek.com/2009/01/wordpress-vs-homemade-php-website/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
