<?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>Jotlab &#187; PHP</title>
	<atom:link href="http://www.jotlab.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jotlab.com</link>
	<description>Jotlab</description>
	<lastBuildDate>Sun, 07 Mar 2010 23:32:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Downgrade PHP 5.3 Port to 5.2.10</title>
		<link>http://www.jotlab.com/2009/10/07/downgrade-php-5-3-port-to-5-2-10/</link>
		<comments>http://www.jotlab.com/2009/10/07/downgrade-php-5-3-port-to-5-2-10/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 04:11:32 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=4204</guid>
		<description><![CDATA[It&#8217;s pretty simple!
Just make sure subversion client is installed and then checkout the php port file with the revision number of 53555 which is the latest for the 5.2.10:

1
2
3
svn co -r 53555 http://svn.macports.org/repository/macports/trunk/dports/lang/php5
cd php5
sudo port install +fastcgi+mysql5+pear

Or you can simply use the branch of PHP 5.2 via:

1
sudo port install php52 +fastcgi+mysql5+pear

Happy porting!
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s pretty simple!<br />
Just make sure subversion client is installed and then checkout the php port file with the revision number of 53555 which is the latest for the 5.2.10:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> <span style="color: #660033;">-r</span> <span style="color: #000000;">53555</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.macports.org<span style="color: #000000; font-weight: bold;">/</span>repository<span style="color: #000000; font-weight: bold;">/</span>macports<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>dports<span style="color: #000000; font-weight: bold;">/</span>lang<span style="color: #000000; font-weight: bold;">/</span>php5
<span style="color: #7a0874; font-weight: bold;">cd</span> php5
<span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> +fastcgi+mysql5+pear</pre></td></tr></table></div>

<p>Or you can simply use the branch of PHP 5.2 via:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> php52 +fastcgi+mysql5+pear</pre></td></tr></table></div>

<p>Happy porting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2009/10/07/downgrade-php-5-3-port-to-5-2-10/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ultimate Guestbook Tutorial: How to build a Guestbook with a honeypot, error checking, IP banning, pagination, e-mail notification and smilies with PHP and mySQL</title>
		<link>http://www.jotlab.com/2008/04/26/ultimate-guestbook-tutorial-how-to-build-a-guestbook-with-a-honeypot-error-checking-ip-banning-pagination-e-mail-notification-and-smilies-with-php-and-mysql/</link>
		<comments>http://www.jotlab.com/2008/04/26/ultimate-guestbook-tutorial-how-to-build-a-guestbook-with-a-honeypot-error-checking-ip-banning-pagination-e-mail-notification-and-smilies-with-php-and-mysql/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 11:52:12 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[guestbook]]></category>
		<category><![CDATA[honey]]></category>
		<category><![CDATA[honeypot]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[pot]]></category>
		<category><![CDATA[smilies]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=1381</guid>
		<description><![CDATA[In this tutorial i will teach you how to make a guestbook script with PHP and mySQL. Guestbooks are very common today on the internet and are great for getting user feedback or a simple hello from your site fan&#8217;s. This tutorial will feature form submission techniques, user input error handling, smilies, honeypot traps, and [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial i will teach you how to make a guestbook script with PHP and mySQL. Guestbooks are very common today on the internet and are great for getting user feedback or a simple hello from your site fan&#8217;s. This tutorial will feature form submission techniques, user input error handling, smilies, honeypot traps, and pagination. The final version of this script can be downloaded below, but i recommend that you follow the tutorial in its entirety so that you can program something similar yourself, or modify the script to suit your needs. </p>
<p>But first of all check out my site if you&#8217;re interested in custom decals! Designed by you made by us! <a href="https://www.wedecal.com/step1">www.wedecal.com</a>!</p>
<p>Source: <a href="http://www.jotlab.com/wp-content/uploads/2008/04/guestbook.zip">guestbook.zip</a><br />
Demo: <a href="http://www.jotlab.com/tutorials/guestbook/">http://www.jotlab.com/tutorials/guestbook/</a></p>
<div align="center"><img src="/wp-content/uploads/2008/04/guestbook.jpg" /></div>
<p><span id="more-1381"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2008/04/26/ultimate-guestbook-tutorial-how-to-build-a-guestbook-with-a-honeypot-error-checking-ip-banning-pagination-e-mail-notification-and-smilies-with-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>57</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to build a poll system with PHP and mySQL</title>
		<link>http://www.jotlab.com/2008/04/11/tutorial-how-to-build-a-poll-system-in-php-and-mysql/</link>
		<comments>http://www.jotlab.com/2008/04/11/tutorial-how-to-build-a-poll-system-in-php-and-mysql/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 04:03:21 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[poll]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=1018</guid>
		<description><![CDATA[If you have been doing the other tutorials on this site you will notice that I have been teaching PHP and mySQL through projects. Projects that you can slot into your website, or if you are building a project, code that you can use within your project. I start from the ground up, assuming you [...]]]></description>
			<content:encoded><![CDATA[<p>If you have been doing the other tutorials on this site you will notice that I have been teaching PHP and mySQL through projects. Projects that you can slot into your website, or if you are building a project, code that you can use within your project. I start from the ground up, assuming you have no prior knowledge of the topic. So today, we will be building a Poll System using PHP and mySQL. Polls are great for getting user feedback from your site visitors.</p>
<p align="center"><img src="/wp-content/uploads/2008/04/poll2.jpg" alt="" /></p>
<p align="center"><img src="http://www.jotlab.com/wp-content/uploads/2008/04/poll.jpg" alt="" /></p>
<p>The poll system we will be using today will read and store from a mySQL database. mySQL is an extremely fast, efficient and stable database tool. Our poll system will read the questions stored in the database, then display the options to the users, then when a user selects an option and clicks submit, that selection will be stored in the database whereby results will be further calculated from this pool of results. The tutorial today will teach you PHP, not the database construction side of things. If you are interested in the mySQL side of it, just load up phpmyadmin and look at the database design I have made for the tutorial. I will however provide you with the database design which you can just import, which I will describe how to do. Anyway, lets get started.</p>
<p>But first of all check out my site if you&#8217;re interested in custom decals! Designed by you made by us! <a href="https://www.wedecal.com/step1">www.wedecal.com</a>!</p>
<p>Source: <a title="poll.zip" href="http://www.jotlab.com/wp-content/uploads/2008/04/poll.zip">poll.zip</a><br />
Demo: <a href="http://www.jotlab.com/tutorials/poll/index.php">http://www.jotlab.com/tutorials/poll/index.php</a><br />
<span id="more-1018"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2008/04/11/tutorial-how-to-build-a-poll-system-in-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>68</slash:comments>
		</item>
		<item>
		<title>HowTo: Get Cookies Across Subdomains PHP</title>
		<link>http://www.jotlab.com/2008/04/08/howto-get-cookies-across-subdomains-php/</link>
		<comments>http://www.jotlab.com/2008/04/08/howto-get-cookies-across-subdomains-php/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 08:48:07 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=725</guid>
		<description><![CDATA[So you are using cookies on your website, but when a visitor visits www.yourdomain.com and yourdomain.com the cookie doesn&#8217;t get set across both! That is because in essence, www. is simply a subdomain. The &#8220;www&#8221; component is not a protocol, it is not necessary, instead all it is, is just a marketing ploy. But anyway. [...]]]></description>
			<content:encoded><![CDATA[<p>So you are using cookies on your website, but when a visitor visits www.yourdomain.com and yourdomain.com the cookie doesn&#8217;t get set across both! That is because in essence, www. is simply a subdomain. The &#8220;www&#8221; component is not a protocol, it is not necessary, instead all it is, is just a marketing ploy. But anyway. Here is what you would do normally:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YourCookieName'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Some Values'</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">3600</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mydomain.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Damn! Almost there! The part you are missing to add a cookie irrespective of the subdomain is &#8220;.mydomain.com&#8221;. Yep, just add a . infront of your domain name. So you would have:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">setcookie</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'YourCookieName'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Some Values'</span><span style="color: #339933;">,</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">3600</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.mydomain.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>All done ^^ Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2008/04/08/howto-get-cookies-across-subdomains-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to make an Image Upload and Thumbnailer Script with cURL</title>
		<link>http://www.jotlab.com/2008/04/08/tutorial-how-to-make-an-image-upload-and-thumbnailer-script-with-curl/</link>
		<comments>http://www.jotlab.com/2008/04/08/tutorial-how-to-make-an-image-upload-and-thumbnailer-script-with-curl/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 07:44:24 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=724</guid>
		<description><![CDATA[So you have completed the file upload tutorial. The tutorial has taught you how to upload an image using a form, and then it auto makes a thumbnail and shows it to you, nice. Now lets say you are on a public computer, and can&#8217;t save to the desktop or whatever. So you would like [...]]]></description>
			<content:encoded><![CDATA[<p>So you have completed the file upload tutorial. The tutorial has taught you how to upload an image using a form, and then it auto makes a thumbnail and shows it to you, nice. Now lets say you are on a public computer, and can&#8217;t save to the desktop or whatever. So you would like to upload a photo that is already on the internet, but thumbnail it to your webserver. We need to be able to allow our users the ability to submit a link to an image and work from there.</p>
<p>Take a look at the demo before jumping in:<br />
<a href="http://www.jotlab.com/tutorials/thumbtutorial/thumbcurl.php">Demo Here</a></p>
<p>What you will need is a decent webserver, PHP with cURL enabled (check in your phpinfo();) and time. Please note that within php you are unable to test for MIME types unless you brute force them, which is beyond the scope of this tutorial. You can however add extensions to PHP to enable access to the mime types of stored files on the server, please take a look <a href="http://www.jellyandcustard.com/2006/01/19/php-mime-types-and-fileinfo/">here</a> for more information. But for this tutorial we will examine the file extensions in the url and go from there.<br />
<span id="more-724"></span><br />
So you have completed the file upload tutorial. The tutorial has taught you how to upload an image using a form, and then it auto makes a thumbnail and shows it to you, nice. Now lets say you are on a public computer, and can&#8217;t save to the desktop or whatever. So you would like to upload a photo that is already on the internet, but thumbnail it to your webserver. We need to be able to allow our users the ability to submit a link to an image and work from there.</p>
<p>Take a look at the demo before jumping in:<br />
<a href="http://www.jotlab.com/tutorials/thumbtutorial/thumbcurl.php">Demo Here</a></p>
<p>What you will need is a decent webserver, PHP with cURL enabled (check in your phpinfo();) and time. Please note that within php you are unable to test for MIME types unless you brute force them, which is beyond the scope of this tutorial. You can however add extensions to PHP to enable access to the mime types of stored files on the server, please take a look <a href="http://www.jellyandcustard.com/2006/01/19/php-mime-types-and-fileinfo/">here</a> for more information. But for this tutorial we will examine the file extensions in the url and go from there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2008/04/08/tutorial-how-to-make-an-image-upload-and-thumbnailer-script-with-curl/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to make an Image Upload and Thumbnailer Script PHP</title>
		<link>http://www.jotlab.com/2008/04/08/tutorial-how-to-make-a-thumbnailer-script/</link>
		<comments>http://www.jotlab.com/2008/04/08/tutorial-how-to-make-a-thumbnailer-script/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 02:23:37 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=721</guid>
		<description><![CDATA[In this tutorial we will make a thumbnailing script using PHP. The script will allow your users to upload their images using a html form, and then be shown the thumbnail and a link to the file on completion. Also the user will be able to specify a max height or width if they want [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial we will make a thumbnailing script using PHP. The script will allow your users to upload their images using a html form, and then be shown the thumbnail and a link to the file on completion. Also the user will be able to specify a max height or width if they want to.</p>
<p>Demo: <a href="http://www.jotlab.com/tutorials/thumbtutorial/thumb.php">http://www.jotlab.com/tutorials/thumbtutorial/thumb.php</a></p>
<p>*Thats right you can host images on my website. But i have edited my code to make the maximum size no greater than 300 pixels*</p>
<p>So start off with. Make a directory on your webserver, call it whatever you want&#8230;.See if i care. Once you have done this make more folders in this folder you made called thumbs and tmp, chmod them both to 777. To chmod you go: right click chmod/properties/get info&#8230;. one of the three. This makes the directories writeable, readable and executable; so you can upload and mangle your files up. Next make a file in this new directory called thumb.php. This will be both our workhorse and our html displayer. So, we have done 3 steps. Congrats!</p>
<p>Now lets open up thumb.php and add in the HTML code. This sets us up with an interface for our users to upload their shiney images.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;
	File:
&lt;input name=&quot;srcimage&quot; type=&quot;file&quot; /&gt;
	Max Dimensions:
&lt;input name=&quot;maxdimensions&quot; type=&quot;text&quot; /&gt; (optional)
&lt;input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;upload&quot; /&gt;
&lt;/form&gt;</pre></div></div>

<p>So i will explain. Line one states that this is a form. It gives it a name, says that the data is to be communicated via the POST gateway and that the encoding type allows files. The other fields are the file, which accepts user input of files, max dimensions and a nice button to click to upload the information.</p>
<p>Next lets get onto some PHP stuff.<br />
<span id="more-721"></span><br />
In this tutorial we will make a thumbnailing script using PHP. The script will allow your users to upload their images using a html form, and then be shown the thumbnail and a link to the file on completion. Also the user will be able to specify a max height or width if they want to.</p>
<p>Demo: <a href="http://www.jotlab.com/thumbtutorial">http://www.jotlab.com/thumbtutorial</a></p>
<p>*Thats right you can host images on my website. But i have edited my code to make the maximum size no greater than 300 pixels*</p>
<p>So start off with. Make a directory on your webserver, call it whatever you want&#8230;.See if i care. Once you have done this make more folders in this folder you made called thumbs and tmp, chmod them both to 777. To chmod you go: right click chmod/properties/get info&#8230;. one of the three. This makes the directories writeable, readable and executable; so you can upload and mangle your files up. Next make a file in this new directory called thumb.php. This will be both our workhorse and our html displayer. So, we have done 3 steps. Congrats!</p>
<p>Now lets open up thumb.php and add in the HTML code. This sets us up with an interface for our users to upload their shiney images.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;form enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;
	File:
&lt;input name=&quot;srcimage&quot; type=&quot;file&quot; /&gt;
	Max Dimensions:
&lt;input name=&quot;maxdimensions&quot; type=&quot;text&quot; /&gt; (optional)
&lt;input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;upload&quot; /&gt;
&lt;/form&gt;</pre></div></div>

<p>So i will explain. Line one states that this is a form. It gives it a name, says that the data is to be communicated via the POST gateway and that the encoding type allows files. The other fields are the file, which accepts user input of files, max dimensions and a nice button to click to upload the information.</p>
<p>Next lets get onto some PHP stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2008/04/08/tutorial-how-to-make-a-thumbnailer-script/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Howto: Get Number of Rows</title>
		<link>http://www.jotlab.com/2008/04/08/howto-get-number-of-rows/</link>
		<comments>http://www.jotlab.com/2008/04/08/howto-get-number-of-rows/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 02:07:39 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=720</guid>
		<description><![CDATA[If you have a MySQL table and you want to know how many records there are in this table you can run a query on the entire table for example:

&#60;?php
&#160;
	//setup a query to select all items
	$query = mysql_query&#40;&#34;SELECT * FROM `tablename`&#34;&#41;;
&#160;
	//now use the magic row counter droid
	$rows = mysql_num_rows&#40;$query&#41;;
&#160;
	echo $rows;
?&#62;

This will show you how many [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a MySQL table and you want to know how many records there are in this table you can run a query on the entire table for example:</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>
&nbsp;
	<span style="color: #666666; font-style: italic;">//setup a query to select all items</span>
	<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM `tablename`&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//now use the magic row counter droid</span>
	<span style="color: #000088;">$rows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$rows</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This will show you how many rows were supplied in that query. So if you want to find out how many people are under 18 in your forums you could do something like this:</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>
&nbsp;
	<span style="color: #000088;">$timegap</span> <span style="color: #339933;">=</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">18</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">365</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">24</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM `tablename` WHERE `dob` &lt; '&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$timegap</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$rows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$rows</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The time gap gets the time in seconds of 18 years, then subtracts it from the time now. Yay. so now you can limit access to minors :O</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2008/04/08/howto-get-number-of-rows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: Doing basic MySQL database stuff</title>
		<link>http://www.jotlab.com/2008/04/08/tutorial-doing-basic-mysql-database-stuff/</link>
		<comments>http://www.jotlab.com/2008/04/08/tutorial-doing-basic-mysql-database-stuff/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 00:22:13 +0000</pubDate>
		<dc:creator>VoiDeT</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=388</guid>
		<description><![CDATA[This tutorial is quite easy. If you want to connect to a mysql database you can use something like this:

$host = 'localhost';
$username = 'yourusername';
$password = 'yourpassword';
$databasename = 'yourdbname';
&#160;
//don't edit this stuff okay?
&#160;
$connect = mysql_connect&#40;$host, $username, $password&#41;;
$selectdb = mysql_select_db&#40;$databasename&#41;;
&#160;
if&#40;$connect == true&#41;&#123;
	echo 'Connected fine!';
&#125; else &#123;
	echo 'Bad Username or Password.....or host dummy!!!!';
&#125;
&#160;
if&#40;$selectdb == true&#41;&#123;
	echo 'Connected to DB [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial is quite easy. If you want to connect to a mysql database you can use something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'yourusername'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'yourpassword'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$databasename</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'yourdbname'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//don't edit this stuff okay?</span>
&nbsp;
<span style="color: #000088;">$connect</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$selectdb</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$databasename</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;">$connect</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Connected fine!'</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: #b1b100;">echo</span> <span style="color: #0000ff;">'Bad Username or Password.....or host dummy!!!!'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$selectdb</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Connected to DB master :D'</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: #b1b100;">echo</span> <span style="color: #0000ff;">'Cant find that database....did we connect?'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>So this code basically connects to the database and says hi!<br />
More to come on DB Functions <img src='http://www.jotlab.com/wp-content/plugins/smilies-themer/Silk/emoticon_wink.png' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2008/04/08/tutorial-doing-basic-mysql-database-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
