<?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>The Tutorial Blog &#187; twitter</title>
	<atom:link href="http://www.thetutorialblog.com/category/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thetutorialblog.com</link>
	<description></description>
	<lastBuildDate>Wed, 07 Jul 2010 23:30:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<image>
<link>http://www.thetutorialblog.com</link>
<url>http://www.thetutorialblog.com/wp-content/plugins/maxblogpress-favicon/icons/favicon-28.ico</url>
<title>The Tutorial Blog</title>
</image>
		<item>
		<title>How to gain more followers on Twitter</title>
		<link>http://www.thetutorialblog.com/twitter/how-to-gain-more-followers-on-twitter/</link>
		<comments>http://www.thetutorialblog.com/twitter/how-to-gain-more-followers-on-twitter/#comments</comments>
		<pubDate>Thu, 27 May 2010 16:34:16 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[twitter]]></category>
		<category><![CDATA[follower]]></category>
		<category><![CDATA[followers]]></category>
		<category><![CDATA[following]]></category>
		<category><![CDATA[gain followers]]></category>
		<category><![CDATA[get followers]]></category>
		<category><![CDATA[get twitter followers]]></category>
		<category><![CDATA[more followers]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[reach more followers]]></category>
		<category><![CDATA[social media]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=321</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Twitter is one of the biggest websites in social media and is only going to grow bigger. I've been on Twitter for a few years now and have learned a few tips to help grow your following and be more influential. Follow Following other people can increase your following because they may follow you back. [...]


Related posts:<ol><li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery Part 2'>Build a Twitter-like site with CodeIgniter and jQuery Part 2</a> <small>Don't forget to check out part 1 if you have...</small></li>
<li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery'>Build a Twitter-like site with CodeIgniter and jQuery</a> <small>This tutorial will be the first of a five part...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-cakephp-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CakePHP and jQuery'>Twitter-like pagination using CakePHP and jQuery</a> <small>I have already done this tutorial with CodeIgniter and jQuery...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Ftwitter%2Fhow-to-gain-more-followers-on-twitter%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Ftwitter%2Fhow-to-gain-more-followers-on-twitter%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="How to gain more followers on Twitter" alt=" How to gain more followers on Twitter" /><br />
			</a>
		</div>
<p style="text-align: center;"><img class="size-full wp-image-322 aligncenter" title="twitter_logo" src="http://www.thetutorialblog.com/wp-content/uploads/2010/05/twitter_logo.gif" alt="twitter logo How to gain more followers on Twitter" width="477" height="200" /></p>
<p>Twitter is one of the biggest websites in social media and is only going to grow bigger. I've been on Twitter for a few years now and have learned a few tips to help grow your following and be more influential.</p>
<h2>Follow</h2>
<p>Following other people can increase your following because they may follow you back. Not everyone will follow you back but a good majority of people will.</p>
<h2>Reply</h2>
<p>If someone sends you an @ reply always make sure to reply to it. If you don't reply to them but are replying to other people then they may get fed up and unfollow you. Also send an @ reply to random people if they ask a question and they may return the favor to you by following.<span id="more-321"></span></p>
<h2>Email</h2>
<p>A good method to pick up new followers is when you email somebody always have a link to your Twitter account, if the person you are emailing is on Twitter they may follow you.</p>
<h2>Website</h2>
<p>It is always a good thing to link to your Twitter account from your website or blog. People who like what you write about can see where you are most of the time and it also allows them to connect with you.</p>
<h2>Business</h2>
<p>If you have a business card then it'd be great to include your Twitter username because this allows for people to easily re-connect with you.</p>
<h2>Comments</h2>
<p>When posting a comment on a blog, instead of posting a link to your website, why not link to your Twitter profile? This will increase the visibility of your Twitter profile on the internet and will probably result in more followers.</p>
<h2>Follow Back</h2>
<p>If somebody follows you and they are not a bot then return the follow and see how you can connect with that person in different ways to build a relationship.</p>
<h2>Clothing</h2>
<p>If you want to really increase the visibility of your Twitter account in the real world then why not get a shirt or any other kind of clothing printed with your Twitter username, you never know how many followers you may be walking passed each day.</p>
<h2>ReTweet</h2>
<p>Retweeting people's links is a great way to get them to follow you, if somebody Retweets a link of mine and I am not following them, I will follow them as a way of saying thanks.</p>
<h2>Share your tips</h2>
<p>What do you find works for you in gaining more followers? Share your tips below with other readers.</p>


<p>Related posts:<ol><li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery Part 2'>Build a Twitter-like site with CodeIgniter and jQuery Part 2</a> <small>Don't forget to check out part 1 if you have...</small></li>
<li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery'>Build a Twitter-like site with CodeIgniter and jQuery</a> <small>This tutorial will be the first of a five part...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-cakephp-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CakePHP and jQuery'>Twitter-like pagination using CakePHP and jQuery</a> <small>I have already done this tutorial with CodeIgniter and jQuery...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/twitter/how-to-gain-more-followers-on-twitter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Build a Twitter-like site with CodeIgniter and jQuery Part 2</title>
		<link>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/</link>
		<comments>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 19:58:15 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Text Tutorials]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[build a social network]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[code igniter]]></category>
		<category><![CDATA[codeigniter series]]></category>
		<category><![CDATA[codeigniter tutorial]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[how to build a social network]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[jquery series]]></category>
		<category><![CDATA[jquery tutorial]]></category>
		<category><![CDATA[php series]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[the tutorial blog]]></category>
		<category><![CDATA[twitter series]]></category>
		<category><![CDATA[twitter tutorial]]></category>
		<category><![CDATA[twitter-like tutorial]]></category>
		<category><![CDATA[wez pyke]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=268</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Don't forget to check out part 1 if you have no read it. In the second part of this 5 part tutorial series on how to build a Twitter-like website, we will be creating a signup form so that users can register to our website. We will be adding records to the database that we [...]


Related posts:<ol><li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery'>Build a Twitter-like site with CodeIgniter and jQuery</a> <small>This tutorial will be the first of a five part...</small></li>
<li><a href='http://www.thetutorialblog.com/php/adding-security-to-codeigniter-forms-with-a-custom-library-class/' rel='bookmark' title='Permanent Link: Adding security to CodeIgniter forms with a custom library class'>Adding security to CodeIgniter forms with a custom library class</a> <small>The class that we are going to create within CI...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CodeIgniter and jQuery'>Twitter-like pagination using CodeIgniter and jQuery</a> <small>If you use Twitter you'll notice that there is a...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery-part-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery-part-2%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Build a Twitter like site with CodeIgniter and jQuery Part 2" alt=" Build a Twitter like site with CodeIgniter and jQuery Part 2" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/cijqt.jpg" alt="CodeIngiter + jQuery=twitter" title="CodeIngiter + jQuery=twitter" width="471" height="211" class="alignleft size-full wp-image-257" /><br />
Don't forget to check out <a href="http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/">part 1</a> if you have no read it.</p>
<p>In the second part of this 5 part tutorial series on how to build a Twitter-like website, we will be creating a signup form so that users can register to our website.</p>
<p>We will be adding records to the database that we created in part 1 and creating validation rules to make sure that the user didn't put any invalid data into the form.<br />
<span id="more-268"></span></p>
<h2>Change the base url</h2>
<p>Navigate to <em>ci_twitter->system->applications->config->config.php</em>.<br />
Change:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'base_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://example.com/&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To the path to where CodeIgniter is. On my machine it would be:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'base_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://tutorials:8888/ci_twitter/&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Create the controller</h2>
<p>We need to create a main controller for things such as the home page, sign up page, login page, etc. Go to <em>ci_twitter->system->application->controllers</em> then in the controllers folder create a file called main.php.</p>
<p>Inside our main controller we now need to define the class and the functions inside it.</p>

<div class="wp_syntax"><div 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;">class</span> main <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> signup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form_validation'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> signin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form_validation'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signin'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If we were to go to <em>http://localhost/ci_twitter/index.php/main/</em> then we will see a blank page.</p>
<h2>Create the views</h2>
<p>Before we can see anything we need to create a folder for the functions in our main controller. Go to <em>ci_twitter->system->application->views</em>. Inside the views folder create another folder called main. In the main folder we will create files for each function that we have in the main controller.</p>
<p>Create these files in the main folder we created:</p>
<ul>
<li>index.php</li>
<li>signup.php</li>
<li>signup_success.php</li>
<li>signin.php</li>
</ul>
<p>Go to index.php and enter Hello World. Now if you go to <em>http://localhost/ci_twitter/index.php/main/</em> you will see Hello World.</p>
<p>The next thing to do is to add a form and text fields so that people can input data. For the sign up page the html is done in the signup.php view file. The validation and processing is done in the main controller inside the signup function.</p>
<p>Add the following code to the signup.php view:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h2&gt;Sign up&lt;/h2&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> validation_errors<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> form_open<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
Full name: &lt;input type=&quot;text&quot; name=&quot;name&quot; /&gt; &lt;br /&gt;
Username: &lt;input type=&quot;text&quot; name=&quot;username&quot; /&gt; &lt;br /&gt;
Password: &lt;input type=&quot;password&quot; name=&quot;password&quot; /&gt; &lt;br /&gt;
Email: &lt;input type=&quot;text&quot; name=&quot;email&quot; /&gt; &lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;Create my account&quot; name=&quot;create&quot; /&gt;
&nbsp;
&lt;/form&gt;</pre></div></div>

<p>Then add this inside signup_success.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Your account was created, <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> anchor<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signin'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'login here'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This is all that we need to do for the sign up view for now. Validation rules is what we will do next in the main controller for sign up.</p>
<h2>Validation</h2>
<p>When doing form validation all of the validation takes place inside of the controller. For now we will set basic validation rules for each field within the form.</p>
<p>In the main controller replace the code for the signup function with:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">function</span> signup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form_validation'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|trim|xss_clean'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Username'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|trim|xss_clean'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Password'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|trim|xss_clean'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|valid_email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup'</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: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup_success'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>If you go to the sign up page now you should see that all the validation code works like it should. Now we will add a model so that we can add the user to the users table.</p>
<h2>Create user model</h2>
<p>Go to the model folder and create a file called User_model.php.</p>
<p>Insert this code into the model:</p>

<div class="wp_syntax"><div 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;">class</span> User_model <span style="color: #000000; font-weight: bold;">extends</span> Model <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> user_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_username'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">count_all_results</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> create_user<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fullname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_fullname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$fullname</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user_username'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user_email'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user_password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</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>Now we need to load the User_model in the controller.<br />
Insert this code in the signup function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">model</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'User_model'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We also need to add the user if the validation rules are passed:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">User_model</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create_user</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup_success'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Part 3</h2>
<p>In part 3 we will be creating a login page and functionality so that people can post messages.</p>
<h2>Download</h2>
<p><a href="http://bit.ly/c7ycMW">Download</a></p>


<p>Related posts:<ol><li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery'>Build a Twitter-like site with CodeIgniter and jQuery</a> <small>This tutorial will be the first of a five part...</small></li>
<li><a href='http://www.thetutorialblog.com/php/adding-security-to-codeigniter-forms-with-a-custom-library-class/' rel='bookmark' title='Permanent Link: Adding security to CodeIgniter forms with a custom library class'>Adding security to CodeIgniter forms with a custom library class</a> <small>The class that we are going to create within CI...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CodeIgniter and jQuery'>Twitter-like pagination using CodeIgniter and jQuery</a> <small>If you use Twitter you'll notice that there is a...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Build a Twitter-like site with CodeIgniter and jQuery</title>
		<link>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/</link>
		<comments>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 15:39:07 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Text Tutorials]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[build a social network]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[code igniter]]></category>
		<category><![CDATA[codeigniter series]]></category>
		<category><![CDATA[codeigniter tutorial]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[how to build a social network]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[jquery series]]></category>
		<category><![CDATA[jquery tutorial]]></category>
		<category><![CDATA[php series]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[the tutorial blog]]></category>
		<category><![CDATA[twitter series]]></category>
		<category><![CDATA[twitter tutorial]]></category>
		<category><![CDATA[twitter-like tutorial]]></category>
		<category><![CDATA[wez pyke]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=256</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	This tutorial will be the first of a five part series where we will built a social network site similar to Twitter from scratch. We will be using the CodeIgniter framework for the core of the website and jQuery for the effects. In this first part we will be configuring CodeIgniter to display everything correctly [...]


Related posts:<ol><li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery Part 2'>Build a Twitter-like site with CodeIgniter and jQuery Part 2</a> <small>Don't forget to check out part 1 if you have...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CodeIgniter and jQuery'>Twitter-like pagination using CodeIgniter and jQuery</a> <small>If you use Twitter you'll notice that there is a...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-cakephp-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CakePHP and jQuery'>Twitter-like pagination using CakePHP and jQuery</a> <small>I have already done this tutorial with CodeIgniter and jQuery...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
		<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Build a Twitter like site with CodeIgniter and jQuery" alt=" Build a Twitter like site with CodeIgniter and jQuery" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/cijqt.jpg" alt="CodeIngiter + jQuery=twitter" title="CodeIngiter + jQuery=twitter" width="471" height="211" class="alignleft size-full wp-image-257" /></p>
<p>This tutorial will be the first of a five part series where we will built a social network site similar to <a href="http://www.twitter.com">Twitter</a> from scratch. We will be using the <a href="http://www.codeigniter.com">CodeIgniter</a> framework for the core of the website and <a href="http://www.jquery.com">jQuery</a> for the effects. In this first part we will be configuring CodeIgniter to display everything correctly and we will also set up a database and connect to it.</p>
<p><span id="more-256"></span></p>
<h2>Download and configure</h2>
<p>Download the <a href="http://www.codeigniter.com">CodeIgniter</a> framework from their website. We don't need to download anything for jQuery because we will be loading it directly from Google as it's quicker to load.</p>
<p>Once you have downloaded the latest version of CodeIgniter from their website, unzip it and copy the files to your public_html folder or equivalent. Rename the CodeIgniter folder to ci_twitter.</p>
<p>Now if you go to http://localhost/ci_twitter you should see something similar to the image below.<br />
<img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/ci.jpg" alt="ci Build a Twitter like site with CodeIgniter and jQuery" title="ci" width="650" height="458" class="alignleft size-full wp-image-261" /></p>
<h2>Database</h2>
<p>We now need configure a database to connect to CodeIgniter so that we can use it to insert and retrieve information. Go to phpMyAdmin or whatever you use for MySQL databases. Create a database called ci_twitter.</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> <span style="color: #008000;">`ci<span style="color: #008080; font-weight: bold;">_</span>twitter`</span> <span style="color: #000033;">;</span></pre></div></div>

<p>For now we are only going to create a table for the users, in another part we will create other tables when we need them.</p>
<p><strong>users table</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`ci<span style="color: #008080; font-weight: bold;">_</span>twitter`</span>.<span style="color: #008000;">`users`</span> <span style="color: #FF00FF;">&#40;</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>id`</span> <span style="color: #999900; font-weight: bold;">INT</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: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>fullname`</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: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>username`</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: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>email`</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: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>password`</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: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>protected<span style="color: #008080; font-weight: bold;">_</span>updates`</span> <span style="color: #999900; font-weight: bold;">TINYINT</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #008000;">'0'</span><span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>location`</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: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>web`</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: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>bio`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">160</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: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ENGINE</span> <span style="color: #CC0099;">=</span> MYISAM</pre></div></div>

<h2>Configure CodeIgniter</h2>
<p>Now that we have set up our database and have inserted a table we will configure CodeIgniter to connect to it.</p>
<p>Navigate to database.php by going to <em>ci_twitter -> system -> application -> config -> database.php</em>. From here enter the correct information for your database so that it connects.</p>
<p>We need to auto load the database library because we will be using it a lot.</p>
<p>Go to <em>autoload.php</em> in the same folder as <em>database.php</em>.</p>
<p>Change:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$autoload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'libraries'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$autoload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'libraries'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'database'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The database library will now load every time without us having to put $this->load->library('database'); in every controller.</p>
<h2>End of Part 1</h2>
<p>This is the end of the first part of approximately five parts.</p>
<h2>Part 2</h2>
<p>Part 2 will be following tomorrow. In part 2 we will be creating a sign up so that we can add users to the database.</p>
<h2>Download</h2>
<p>You can download part one from <a href="http://bit.ly/91HSQ0">here</a></p>


<p>Related posts:<ol><li><a href='http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/' rel='bookmark' title='Permanent Link: Build a Twitter-like site with CodeIgniter and jQuery Part 2'>Build a Twitter-like site with CodeIgniter and jQuery Part 2</a> <small>Don't forget to check out part 1 if you have...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-codeigniter-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CodeIgniter and jQuery'>Twitter-like pagination using CodeIgniter and jQuery</a> <small>If you use Twitter you'll notice that there is a...</small></li>
<li><a href='http://www.thetutorialblog.com/php/twitter-like-pagination-using-cakephp-and-jquery/' rel='bookmark' title='Permanent Link: Twitter-like pagination using CakePHP and jQuery'>Twitter-like pagination using CakePHP and jQuery</a> <small>I have already done this tutorial with CodeIgniter and jQuery...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
