<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP-Princess.net &#187; Code Snippets</title>
	<atom:link href="http://php-princess.net/category/code-snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://php-princess.net</link>
	<description></description>
	<lastBuildDate>Sun, 14 Mar 2010 00:07:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<script type="text/javascript">
if (typeof Meebo == "undefined") {
Meebo=function(){(Meebo._=Meebo._||[]).push(arguments)};
(function(q){

	var args = arguments;
	if (!document.body) { return setTimeout(function(){ args.callee.apply(this, args) }, 100); }
	var d=document, b=d.body, m=b.insertBefore(d.createElement('div'), b.firstChild); s=d.createElement('script');
	m.id='meebo'; m.style.display='none'; m.innerHTML='<iframe id="meebo-iframe"></iframe>';
	s.src='http'+(q.https?'s':'')+'://'+(q.stage?'stage-':'')+'cim.meebo.com/cim/cim.php?network='+q.network;
	b.insertBefore(s, b.firstChild);

})({network:'phpprincessnet_ba02xu'});	}</script>	<item>
		<title>Microsoft Office 2007 Files Downloading as .Zip Files</title>
		<link>http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/</link>
		<comments>http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 21:48:18 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[problemsolving]]></category>

		<guid isPermaLink="false">http://php-princess.net/?p=1005</guid>
		<description><![CDATA[A colleague IMed me earlier today. She was wondering why her .xlsx document was downloading as a strange .zip file. She had uploaded it into the content management system correctly, but when she tried to test it out, the file looked corrupted.
Albert did some digging around and figured that the Microsoft Office 2007 files extensions [...]]]></description>
			<content:encoded><![CDATA[<p>A colleague IMed me earlier today. She was wondering why her .xlsx document was downloading as a strange .zip file. She had uploaded it into the content management system correctly, but when she tried to test it out, the file looked corrupted.</p>
<p><a href="http://albertech.net/?p=24">Albert</a> did some digging around and figured that the Microsoft Office 2007 files extensions were not recognized by Apache. So downloading files like .xlsx, .docx, .pptx, etc. will translate to file<strong>.zip</strong> instead. I did some further browser testing and noticed this problem only appears in IE browsers. It works perfectly in Firefox, Chrome, and Safari.</p>
<p>To fix this problem, you would need to add the extensions to the Apache config file.</p>
<p><strong>Step 1:</strong> Make sure you back up your configuration file (httpd.conf in Apache) or (apache2.conf in Apache2)</p>
<p><strong>Step 2:</strong> Search for the section with the AddType keywords. </p>
<p><strong>Step 3:</strong> Add the following lines:</p>
<p><code><br />
# MIME type fix<br />
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx<br />
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx<br />
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow .pptx<br />
</code></p>
<p>If you load other Microsoft Office 2007 files on your Apache web server, you may want to add additional <a href="http://www.webmasterworld.com/apache/3539138.htm">file extensions</a>.</p>
<p>Thanks for figuring it out <a href="http://albertech.net/">Albert</a>! That solved the mystery behind two work tickets today.</p>
<p><strong>Sources:</strong> <a href="http://albertech.net/?p=24">Albertech.net</a>, <a href="http://www.webmasterworld.com/apache/3539138.htm">MS Office 2007 File Extensions at WebmasterWorld</a></p>
<p><map name='google_ad_map_1005_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/1005?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_1005_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=1005&amp;url= http%3A%2F%2Fphp-princess.net%2F2008%2F11%2F13%2Fmicrosoft-office-2007-files-downloading-as-zip-files%2F' /></p>
<div class='amazonfeed'><h3>Related Reading:</h3>
<div class='product'><a href='http://www.amazon.com/Negotiation-Processes-Problem-Solving-Carrie-Menkel-Meadow/dp/0735544417?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0735544417' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/41taleIO-yL._SL75_.jpg' class='amazonfeed-product-image' alt='Negotiation: Processes for Problem-Solving (Casebook Series)' title='Negotiation: Processes for Problem-Solving (Casebook Series)' /><span class='amazonfeed-product-title'>Negotiation: Processes for Problem-Solving (Casebook Series)</span></a>
</div><div class='product'><a href='http://www.amazon.com/Microsoft-Office-Home-Student-2007/dp/B000HCZ8EO?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B000HCZ8EO' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/41MRo3skm8L._SL75_.jpg' class='amazonfeed-product-image' alt='Microsoft Office Home and Student 2007' title='Microsoft Office Home and Student 2007' /><span class='amazonfeed-product-title'>Microsoft Office Home and Student 2007</span></a>
</div><div class='product'><a href='http://www.amazon.com/Apache-Inside-Cockpit-Fighting-Machine/dp/B0033AGSSW?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B0033AGSSW' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/51hT4aljydL._SL75_.jpg' class='amazonfeed-product-image' alt='Apache: Inside the Cockpit of the World&#039;s Most Deadly Fighting Machine' title='Apache: Inside the Cockpit of the World&#039;s Most Deadly Fighting Machine' /><span class='amazonfeed-product-title'>Apache: Inside the Cockpit of the World's Most Deadly Fighting Machine</span></a>
</div><div class='product'><a href='http://www.amazon.com/Problem-Solving-Circle/dp/B001W2LZLS?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=usamazonfeed-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B001W2LZLS' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/51lPocCGTRL._SL75_.jpg' class='amazonfeed-product-image' alt='Problem-Solving Circle' title='Problem-Solving Circle' /><span class='amazonfeed-product-title'>Problem-Solving Circle</span></a>
</div><div class='product'><a href='http://www.amazon.com/Microsoft-Windows-Home-Premium-Upgrade/dp/B002DHLUWK?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B002DHLUWK' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/41y0loT30RL._SL75_.jpg' class='amazonfeed-product-image' alt='Microsoft Windows 7 Home Premium Upgrade' title='Microsoft Windows 7 Home Premium Upgrade' /><span class='amazonfeed-product-title'>Microsoft Windows 7 Home Premium Upgrade</span></a>
</div></div><img style='display:none' id="post-1005-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/',title:'Microsoft Office 2007 Files Downloading as .Zip Files',tweet:'A colleague IMed me earlier today. She was wondering why her .xlsx document was downloading as a str',description:'A colleague IMed me earlier today. She was wondering why her .xlsx document was downloading as a str'})"><script type='text/javascript'>document.getElementById("post-1005-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files+-+http://tinyurl.com/88c5q5+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;t=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;title=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;t=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;title=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;title=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;title=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;title=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/&amp;title=Microsoft+Office+2007+Files+Downloading+as+.Zip+Files" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=1005&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2008/11/13/microsoft-office-2007-files-downloading-as-zip-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Email Validation</title>
		<link>http://php-princess.net/2007/08/20/php-email-validation/</link>
		<comments>http://php-princess.net/2007/08/20/php-email-validation/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 00:34:54 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://php-princess.net/2007/08/20/php-email-validation/</guid>
		<description><![CDATA[Note to self, use this for email validation:
function isEmail($email)
{
	if(ereg("^([a-zA-Z0-9_\-\.]+)@
          ((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)&#124;
          (([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}&#124;[0-9]{1,3})(\]?)$", $email))
		return 1;		// If email address is valid
	else
		return 0;
}

Minus all the spaces in the ereg function.




document.getElementById("post-595-blankimage").onload();




		
			Tweet This!
		
		
			Share this on Facebook
		
		
			Share this on del.icio.us
		
		
			Post this to MySpace
		
		
			Digg this!
		
		
			Subscribe [...]]]></description>
			<content:encoded><![CDATA[<p>Note to self, use this for email validation:</p>
<p><code>function isEmail($email)<br />
{<br />
	if(ereg("^([a-zA-Z0-9_\-\.]+)@<br />
          ((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|<br />
          (([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email))<br />
		return 1;		// If email address is valid<br />
	else<br />
		return 0;<br />
}<br />
</code></p>
<p>Minus all the spaces in the ereg function.</p>
<p><map name='google_ad_map_595_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/595?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_595_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=595&amp;url= http%3A%2F%2Fphp-princess.net%2F2007%2F08%2F20%2Fphp-email-validation%2F' /></p>
<img style='display:none' id="post-595-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2007/08/20/php-email-validation/',title:'PHP Email Validation',tweet:'Note to self, use this for email validation: function isEmail($email) { 	if(ereg(\"^([a-zA-Z0-9_\\-\\.]',description:'Note to self, use this for email validation: function isEmail($email) { 	if(ereg(\"^([a-zA-Z0-9_\\-\\.]'})"><script type='text/javascript'>document.getElementById("post-595-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=PHP+Email+Validation+-+http://tinyurl.com/qs5j59+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2007/08/20/php-email-validation/&amp;t=PHP+Email+Validation" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2007/08/20/php-email-validation/&amp;title=PHP+Email+Validation" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2007/08/20/php-email-validation/&amp;t=PHP+Email+Validation" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2007/08/20/php-email-validation/&amp;title=PHP+Email+Validation" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2007/08/20/php-email-validation/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2007/08/20/php-email-validation/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2007/08/20/php-email-validation/&amp;title=PHP+Email+Validation" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2007/08/20/php-email-validation/&amp;title=PHP+Email+Validation" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2007/08/20/php-email-validation/&amp;title=PHP+Email+Validation" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2007/08/20/php-email-validation/&amp;title=PHP+Email+Validation" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=595&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2007/08/20/php-email-validation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS 3: Substring Matching Attribute Selectors</title>
		<link>http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/</link>
		<comments>http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/#comments</comments>
		<pubDate>Sat, 17 Mar 2007 04:37:55 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Tips and Tutorials]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/</guid>
		<description><![CDATA[I was reading up on CSS 3&#8217;s Substring matching attribute selectors and discovered a fun way to reference anchor links!
Web links can be a variety of files.  PDF, DOC, and HTML are some of the familiar ones.  I was wondering if we could put a small icon to denote what type of file [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://php-princess.net/wp-content/uploads/css-icon.png" alt="css-icon" title="css-icon" class="alignright size-full wp-image-1774" />I was reading up on <a href="http://www.w3.org/TR/css3-selectors/#attribute-representation">CSS 3&#8217;s Substring matching attribute selectors</a> and discovered a fun way to reference anchor links!</p>
<p>Web links can be a variety of files.  PDF, DOC, and HTML are some of the familiar ones.  I was wondering if we could put a small icon to denote what type of file is being downloaded, and with CSS3, it&#8217;s quite possible.</p>
<p>Create an HTML file.  Between the &lt;head&gt; tags, put</p>
<pre class="brush:css">
&lt;style&gt;
body {
  font-size: .9em; font-weight: bold;
}
a { color: blue; line-height: 1.5em; }
a[href$=".html"] {
   padding-left:20px; background-image:url(html.gif);
   background-repeat: no-repeat;
}
a[href$=".pdf"] {
   padding-left:20px; background-image:url(pdf.gif);
   background-repeat: no-repeat;
}
a[href$=".doc"] {
   padding-left:20px; background-image:url(msword.gif);
   background-repeat: no-repeat;
}
&lt;/style&gt;</pre>
<p>and between the &lt;body&gt; tags, put:</p>
<pre class="brush:html">&lt;ul&gt;
&lt;li&gt;&lt;a href="myfile.html"&gt;My HTML File&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="myfile.pdf"&gt;My PDF File&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="myfile.doc"&gt;My Word Doc File&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://php-princess.net"&gt;Any Link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>Save the file as mytest.html (and download these three images as well &#8212; <img src="http://php-princess.net/wp-content/uploads/msword.gif" alt="MS Word" /> <img src="http://php-princess.net/wp-content/uploads/pdf.gif" alt="PDF" /> <img src="http://php-princess.net/wp-content/uploads/html.gif" alt="HTML" />) and open it up in Firefox 2.0.  You will then see something that looks like this:</p>
<p><img src="http://php-princess.net/wp-content/uploads/css3-links.jpg" alt="CSS 3 Links" /><br />
Isn&#8217;t that great?  The padding attribute moves the link 20px to the right.  And the background-repeat attribute makes sure that image doesn&#8217;t repeat. So when I link a PDF file on my website, an image of a PDF file automatically shows next to the link.  What a time-saver. :)  The only drawback to this is that CSS3 isn&#8217;t fully implemented in all of today&#8217;s browser.  It seems that Firefox 2.0 is ahead in the game.  MSIE 7.0 and browsers below do not render CSS3 correctly.  But it is a nice tip.  Hopefully the next generation of browsers will render CSS3 the way it&#8217;s suppose to.</p>
<p><map name='google_ad_map_451_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/451?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_451_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=451&amp;url= http%3A%2F%2Fphp-princess.net%2F2007%2F03%2F16%2Fcss-3-substring-matching-attribute-selectors%2F' /></p>
<div class='amazonfeed'><h3>Related Reading:</h3>
<div class='product'><a href='http://www.amazon.com/CSS-Pocket-Reference-Presentation-OReilly/dp/0596515057?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=usamazonfeed-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0596515057' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/51fHq9mfG3L._SL75_.jpg' class='amazonfeed-product-image' alt='CSS Pocket Reference: Visual Presentation for the Web (Pocket Reference (O&#039;Reilly))' title='CSS Pocket Reference: Visual Presentation for the Web (Pocket Reference (O&#039;Reilly))' /><span class='amazonfeed-product-title'>CSS Pocket Reference: Visual Presentation for the Web (Pocket Reference (O'Reilly))</span></a>
</div><div class='product'><a href='http://www.amazon.com/Transcending-CSS-Fine-Art-Design/dp/0321410971?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0321410971' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/61HoDC9bUOL._SL75_.jpg' class='amazonfeed-product-image' alt='Transcending CSS: The Fine Art of Web Design' title='Transcending CSS: The Fine Art of Web Design' /><span class='amazonfeed-product-title'>Transcending CSS: The Fine Art of Web Design</span></a>
</div><div class='product'><a href='http://www.amazon.com/Talent-Code-Greatness-Born-Grown/dp/055380684X?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=055380684X' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/413RBPK%2BvoL._SL75_.jpg' class='amazonfeed-product-image' alt='The Talent Code: Greatness Isn&#039;t Born. It&#039;s Grown. Here&#039;s How.' title='The Talent Code: Greatness Isn&#039;t Born. It&#039;s Grown. Here&#039;s How.' /><span class='amazonfeed-product-title'>The Talent Code: Greatness Isn't Born. It's Grown. Here's How.</span></a>
</div><div class='product'><a href='http://www.amazon.com/HTML-XHTML-Sixth-Elizabeth-Castro/dp/0321430840?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0321430840' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/51Ilb0dwmBL._SL75_.jpg' class='amazonfeed-product-image' alt='HTML, XHTML, and CSS, Sixth Edition' title='HTML, XHTML, and CSS, Sixth Edition' /><span class='amazonfeed-product-title'>HTML, XHTML, and CSS, Sixth Edition</span></a>
</div><div class='product'><a href='http://www.amazon.com/Code-Language-Computer-Hardware-Software/dp/0735611319?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0735611319' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/31u1uhiu3QL._SL75_.jpg' class='amazonfeed-product-image' alt='Code: The Hidden Language of Computer Hardware and Software' title='Code: The Hidden Language of Computer Hardware and Software' /><span class='amazonfeed-product-title'>Code: The Hidden Language of Computer Hardware and Software</span></a>
</div></div><img style='display:none' id="post-451-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/',title:'CSS 3: Substring Matching Attribute Selectors',tweet:'I was reading up on CSS 3&#8217;s Substring matching attribute selectors and discovered a fun way to',description:'I was reading up on CSS 3&#8217;s Substring matching attribute selectors and discovered a fun way to'})"><script type='text/javascript'>document.getElementById("post-451-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=CSS+3%3A+Substring+Matching+Attribute+Selectors+-+http://tinyurl.com/mr38p7+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;t=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;title=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;t=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;title=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;title=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;title=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;title=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/&amp;title=CSS+3%3A+Substring+Matching+Attribute+Selectors" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=451&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2007/03/16/css-3-substring-matching-attribute-selectors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Connect to a MySQL Database using PHP</title>
		<link>http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/</link>
		<comments>http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/#comments</comments>
		<pubDate>Tue, 29 Mar 2005 20:34:38 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts and Coding]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://daynah.php-princess.net/?p=249</guid>
		<description><![CDATA[I was helping my coworker yesterday to create her first PHP-Database program.  She already knew how phpMyAdmin worked, so I created a sample page for her to show how to connect to the database and then retrieve data from a query.  Maybe this sample page could help you too.  I commented as [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://php-princess.net/wp-content/uploads/tn-php.png" title="PHP" class="alignright" width="70" height="70" />I was helping my coworker yesterday to create her first PHP-Database program.  She already knew how phpMyAdmin worked, so I created a sample page for her to show how to connect to the database and then retrieve data from a query.  Maybe this sample page could help you too.  I commented as much of the code as I could.  Let me know if you have any questions.</p>
<p><span id="more-249"></span></p>
<pre class="brush:php">
&lt;?php

/*
	Purpose: This file demonstrates how to run
		and display a mySQL query using PHP.
	Author : Daynah
	Created: 2005/03/28
*/

// Variables for database
$username     = "TestUser";
$dbpword      = "TestPassword";
$database     = "test_database_name";
$host         = "localhost";

// Connect to the database
$db = mysql_connect($host, $username, $dbpword )
	or die ("ERROR: " .mysql_error());
$connection = mysql_select_db( $database, $db );

// Run a query
$query = "SELECT * FROM myTestTable";		// The mysql statement
$result = mysql_query($query);				// The results of a query
$num_rows = mysql_num_rows($result);		// Number of rows of data

// Start the table to display the data
echo '&lt;table&gt;';

// If there is data in that query, display the data
if($num_rows)
{
	// PHP Script to iterate through the data in the database
	// This will print out each Table Row
	/*	|   ID	| Name	|  Address	|
		-----------------------------
			1	  Name1		Address1
			2	  Name2		Address2
		Assuming there are three fields in the table -- ID, Name, and Address
	*/
	while($myData = mysql_fetch_object($result)
	{
		// Print Each Row of Data -- ID, Name, Address
		echo '&lt;tr&gt;&lt;td&gt;'. $myData-&gt;ID.'&lt;/td&gt;
				  &lt;td&gt;'. $myData-&gt;Name.'&lt;/td&gt;
				  &lt;td&gt;'. $myData-&gt;Address.'&lt;/td&gt;
			  &lt;/tr&gt;';
	}
}

// If there is no data in the database.
else
{
	echo '&lt;tr&gt;&lt;td&gt;Sorry, there is no data in the database.&lt;/td&gt;&lt;/tr&gt;';
}

// Close the table tag
echo '&lt;/table&gt;';

// Close Mysql Connection
mysql_close();

?&gt;
</pre>
<p><map name='google_ad_map_249_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/249?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_249_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=249&amp;url= http%3A%2F%2Fphp-princess.net%2F2005%2F03%2F29%2Fhow-to-connect-to-a-database-using-php-and-mysql%2F' /></p>
<div class='amazonfeed'><h3>Related Reading:</h3>
<div class='product'><a href='http://www.amazon.com/MySQL-4th-Paul-DuBois/dp/0672329387?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0672329387' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/41nW9XWOliL._SL75_.jpg' class='amazonfeed-product-image' alt='MySQL (4th Edition)' title='MySQL (4th Edition)' /><span class='amazonfeed-product-title'>MySQL (4th Edition)</span></a>
</div><div class='product'><a href='http://www.amazon.com/Databases-Demystified-Andrew-Oppel/dp/0072253649?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0072253649' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/5157Jt6G6qL._SL75_.jpg' class='amazonfeed-product-image' alt='Databases Demystified (Demystified)' title='Databases Demystified (Demystified)' /><span class='amazonfeed-product-title'>Databases Demystified (Demystified)</span></a>
</div><div class='product'><a href='http://www.amazon.com/MySQL-Cookbook-Paul-DuBois/dp/059652708X?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=usamazonfeed-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=059652708X' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/51LH96iCyNL._SL75_.jpg' class='amazonfeed-product-image' alt='MySQL Cookbook' title='MySQL Cookbook' /><span class='amazonfeed-product-title'>MySQL Cookbook</span></a>
</div><div class='product'><a href='http://www.amazon.com/PHP-World-Wide-Web-Third/dp/0321442490?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0321442490' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/41pV4IaBEoL._SL75_.jpg' class='amazonfeed-product-image' alt='PHP for the World Wide Web, Third Edition' title='PHP for the World Wide Web, Third Edition' /><span class='amazonfeed-product-title'>PHP for the World Wide Web, Third Edition</span></a>
</div><div class='product'><a href='http://www.amazon.com/MySQL-Crash-Course-Ben-Forta/dp/0672327120?SubscriptionId=0MQT6ZPCBGMCABAC0502&tag=daynah-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=0672327120' target='' rel='nofollow'><img src='http://ecx.images-amazon.com/images/I/41rnoSLQe-L._SL75_.jpg' class='amazonfeed-product-image' alt='MySQL Crash Course' title='MySQL Crash Course' /><span class='amazonfeed-product-title'>MySQL Crash Course</span></a>
</div></div><img style='display:none' id="post-249-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/',title:'How to Connect to a MySQL Database using PHP',tweet:'I was helping my coworker yesterday to create her first PHP-Database program.  She already knew how ',description:'I was helping my coworker yesterday to create her first PHP-Database program.  She already knew how '})"><script type='text/javascript'>document.getElementById("post-249-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=How+to+Connect+to+a+MySQL+Database+using+PHP+-+http://tinyurl.com/omcerp+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;t=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;title=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;t=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;title=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;title=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;title=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;title=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/&amp;title=How+to+Connect+to+a+MySQL+Database+using+PHP" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=249&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2005/03/29/how-to-connect-to-a-database-using-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing last character of a string</title>
		<link>http://php-princess.net/2004/06/30/removing-last-character-of-a-string/</link>
		<comments>http://php-princess.net/2004/06/30/removing-last-character-of-a-string/#comments</comments>
		<pubDate>Wed, 30 Jun 2004 17:09:18 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://daynah.php-princess.net/?p=165</guid>
		<description><![CDATA[I had a string that looked like: 
2;4;6;7;
The string is dynamic, so it could also be:
3;5;2;8;9;
I needed to remove the last ; (semicolon) from the string but wasn&#8217;t sure what the best method of doing this was.  I thought about using the strlen() (string length) function.  Get the value of how long the [...]]]></description>
			<content:encoded><![CDATA[<p>I had a string that looked like: </p>
<p><code>2;4;6;7;</code></p>
<p>The string is dynamic, so it could also be:</p>
<p><code>3;5;2;8;9;</code></p>
<p>I needed to remove the last ; (semicolon) from the string but wasn&#8217;t sure what the best method of doing this was.  I thought about using the <a href="http://php.net/strlen">strlen()</a> (string length) function.  Get the value of how long the string is, and then removed the last character using <a href="http://php.net/substr">substr()</a>.  The task seems a bit tedious and unefficient though.  </p>
<p>So I searched <a href="http://www.google.com">Google</a> to find the best method, and stumbled upon <a href="http://www.wellho.net/forum/Writing-PHP/Removing-last-character-of-a-string.html">the answer to my question</a> &#8212; How do you remove the last character of a string?</p>
<p>The solution is to use:<br />
<code>$outgoing = substr_replace($incoming,"",-1);</code></p>
<p>So if I use:<br />
<code>$outgoing = substr_replace('3;5;2;8;9;',"",-1);</code></p>
<p>My output would be:<br />
<code>3;5;2;8;9</code></p>
<p>Exactly what I was looking for! Thank you <a href="http://www.wellho.net/forum/">Graham Ellis</a>! </p>
<p><map name='google_ad_map_165_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/165?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_165_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=165&amp;url= http%3A%2F%2Fphp-princess.net%2F2004%2F06%2F30%2Fremoving-last-character-of-a-string%2F' /></p>
<img style='display:none' id="post-165-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2004/06/30/removing-last-character-of-a-string/',title:'Removing last character of a string',tweet:'I had a string that looked like:  2;4;6;7; The string is dynamic, so it could also be: 3;5;2;8;9; I ',description:'I had a string that looked like:  2;4;6;7; The string is dynamic, so it could also be: 3;5;2;8;9; I '})"><script type='text/javascript'>document.getElementById("post-165-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Removing+last+character+of+a+string+-+http://tinyurl.com/p5e745+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;t=Removing+last+character+of+a+string" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;title=Removing+last+character+of+a+string" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;t=Removing+last+character+of+a+string" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;title=Removing+last+character+of+a+string" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2004/06/30/removing-last-character-of-a-string/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;title=Removing+last+character+of+a+string" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;title=Removing+last+character+of+a+string" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;title=Removing+last+character+of+a+string" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2004/06/30/removing-last-character-of-a-string/&amp;title=Removing+last+character+of+a+string" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=165&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2004/06/30/removing-last-character-of-a-string/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Animation using CSS</title>
		<link>http://php-princess.net/2004/05/06/animation-using-css/</link>
		<comments>http://php-princess.net/2004/05/06/animation-using-css/#comments</comments>
		<pubDate>Thu, 06 May 2004 21:57:07 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Links and Resources]]></category>

		<guid isPermaLink="false">http://daynah.php-princess.net/?p=145</guid>
		<description><![CDATA[I was reading this article called &#8220;CSS Sprites: Image Slicing&#8217;s Kiss of Death&#8221; which shows how we can animate images, using only CSS and no javascript.  I decided to try it out for myself, and played with the code for a bit.  I came up with this this example using an image.  [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading this article called &#8220;<a href="http://alistapart.com/articles/sprites/">CSS Sprites: Image Slicing&#8217;s Kiss of Death</a>&#8221; which shows how we can animate images, using only CSS and no javascript.  I decided to try it out for myself, and played with the code for a bit.  I came up with this <a href="http://tutorials.php-princess.net/css/animated.html">this example</a> using an image.  The amazing thing part is that only <a href="http://tutorials.php-princess.net/css/phpp.jpg">one image</a> was used.  The coding for this trick is very condensed and much shorter than a javascript.  One advantage this has over using javascript is that it is much faster.  There&#8217;s no delay with multiple image swapping.  Instead, css displays a different part of one image.</p>
<p><a href="http://alistapart.com/articles/sprites/">Read more</a> about this CSS trick and see if you can give your webpage a little more life. :)</p>
<p><map name='google_ad_map_145_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/145?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_145_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=145&amp;url= http%3A%2F%2Fphp-princess.net%2F2004%2F05%2F06%2Fanimation-using-css%2F' /></p>
<img style='display:none' id="post-145-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2004/05/06/animation-using-css/',title:'Animation using CSS',tweet:'I was reading this article called &#8220;CSS Sprites: Image Slicing&#8217;s Kiss of Death&#8221; whi',description:'I was reading this article called &#8220;CSS Sprites: Image Slicing&#8217;s Kiss of Death&#8221; whi'})"><script type='text/javascript'>document.getElementById("post-145-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Animation+using+CSS+-+http://tinyurl.com/qc2m8m+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2004/05/06/animation-using-css/&amp;t=Animation+using+CSS" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2004/05/06/animation-using-css/&amp;title=Animation+using+CSS" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2004/05/06/animation-using-css/&amp;t=Animation+using+CSS" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2004/05/06/animation-using-css/&amp;title=Animation+using+CSS" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2004/05/06/animation-using-css/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2004/05/06/animation-using-css/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2004/05/06/animation-using-css/&amp;title=Animation+using+CSS" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2004/05/06/animation-using-css/&amp;title=Animation+using+CSS" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2004/05/06/animation-using-css/&amp;title=Animation+using+CSS" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2004/05/06/animation-using-css/&amp;title=Animation+using+CSS" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=145&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2004/05/06/animation-using-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Easter Date</title>
		<link>http://php-princess.net/2004/03/29/easter-date/</link>
		<comments>http://php-princess.net/2004/03/29/easter-date/#comments</comments>
		<pubDate>Mon, 29 Mar 2004 17:42:45 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://daynah.php-princess.net/?p=140</guid>
		<description><![CDATA[Are you wondering what day Easter falls on this year?  Not to worry, a simple PHP script can figure it out faster than you flipping a calendar.  heh Ok, maybe not, but it&#8217;s still a neat trick. :)
Just put this code in a php file, uploaded and see for yourself.
< ? echo date [...]]]></description>
			<content:encoded><![CDATA[<p>Are you wondering what day Easter falls on this year?  Not to worry, a simple PHP script can figure it out faster than you flipping a calendar.  heh Ok, maybe not, but it&#8217;s still a neat trick. :)</p>
<p>Just put this code in a php file, uploaded and see for yourself.<br />
<code style="font-size: 12px;">< ? echo date ("M-d-Y", easter_date(2004)); ?></></code></p>
<p><a href="http://board.php-princess.net/index.php?showtopic=67&#038;hl=easter">More information here</a>.</p>
<p><map name='google_ad_map_140_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/140?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_140_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=140&amp;url= http%3A%2F%2Fphp-princess.net%2F2004%2F03%2F29%2Feaster-date%2F' /></p>
<img style='display:none' id="post-140-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2004/03/29/easter-date/',title:'Easter Date',tweet:'Are you wondering what day Easter falls on this year?  Not to worry, a simple PHP script can figure ',description:'Are you wondering what day Easter falls on this year?  Not to worry, a simple PHP script can figure '})"><script type='text/javascript'>document.getElementById("post-140-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Easter+Date+-+http://tinyurl.com/nqa75l+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2004/03/29/easter-date/&amp;t=Easter+Date" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2004/03/29/easter-date/&amp;title=Easter+Date" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2004/03/29/easter-date/&amp;t=Easter+Date" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2004/03/29/easter-date/&amp;title=Easter+Date" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2004/03/29/easter-date/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2004/03/29/easter-date/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2004/03/29/easter-date/&amp;title=Easter+Date" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2004/03/29/easter-date/&amp;title=Easter+Date" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2004/03/29/easter-date/&amp;title=Easter+Date" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2004/03/29/easter-date/&amp;title=Easter+Date" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=140&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2004/03/29/easter-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RAND() function in MySql</title>
		<link>http://php-princess.net/2003/07/20/rand-function-in-mysql/</link>
		<comments>http://php-princess.net/2003/07/20/rand-function-in-mysql/#comments</comments>
		<pubDate>Mon, 21 Jul 2003 02:08:56 +0000</pubDate>
		<dc:creator>daynah</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://daynah.php-princess.net/?p=120</guid>
		<description><![CDATA[I was trying to use this query to get a random row from the database:
$myRandom = "SELECT * FROM MYTABLE ORDER BY RAND() LIMIT 1";
and I couldn&#8217;t figure out why it would continually get the previous number instead of some random number.  
Ahh, but look what&#8217;s at the bottom of the page. ;)
&#8220;As of [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to use this query to get a random row from the database:</p>
<p><code>$myRandom = "SELECT * FROM MYTABLE ORDER BY RAND() LIMIT 1";</code></p>
<p>and I couldn&#8217;t figure out why it would continually get the previous number instead of some random number.  </p>
<p>Ahh, but look what&#8217;s at the bottom of the page. ;)</p>
<p>&#8220;As of MySQL 3.23.52, MySQL changed the way RAND() functions, such that you MUST supply a SEED to get an actual random number. If you do not, each new connection will return close to the same number as the previous new connection. An example to test this would be to run the follow  command multiple times in a row. mysql -u username -p -e&#8217;select rand()&#8217; A basic way to seed this would be to run RAND(NOW()).&#8221; </p>
<p>So now I know, I must provide a random seed. ;)</p>
<p><b>Source:</b> <a href="http://www.mysql.com/doc/en/Mathematical_functions.html#IDX1265" target="_blank">http://www.mysql.com</a></p>
<p><map name='google_ad_map_120_5ca5e442dc272ca0'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/120?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_120_5ca5e442dc272ca0' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=120&amp;url= http%3A%2F%2Fphp-princess.net%2F2003%2F07%2F20%2Frand-function-in-mysql%2F' /></p>
<img style='display:none' id="post-120-blankimage" onload="Meebo('discoverSharable', {element: ((this.parentNode.className.match('post')) ? this.parentNode : this.parentNode.parentNode) ,url:'http://php-princess.net/2003/07/20/rand-function-in-mysql/',title:'RAND() function in MySql',tweet:'I was trying to use this query to get a random row from the database: $myRandom = \"SELECT * FROM MYT',description:'I was trying to use this query to get a random row from the database: $myRandom = \"SELECT * FROM MYT'})"><script type='text/javascript'>document.getElementById("post-120-blankimage").onload();</script>

<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=RAND%28%29+function+in+MySql+-+http://tinyurl.com/orcg49+(via+@daynah)" rel="" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;t=RAND%28%29+function+in+MySql" rel="" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;title=RAND%28%29+function+in+MySql" rel="" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;t=RAND%28%29+function+in+MySql" rel="" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;title=RAND%28%29+function+in+MySql" rel="" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://php-princess.net/2003/07/20/rand-function-in-mysql/feed" rel="" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-technorati">
			<a href="http://technorati.com/faves?add=http://php-princess.net/2003/07/20/rand-function-in-mysql/" rel="" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;title=RAND%28%29+function+in+MySql" rel="" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-google">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;title=RAND%28%29+function+in+MySql" rel="" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;title=RAND%28%29+function+in+MySql" rel="" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-mixx">
			<a href="http://www.mixx.com/submit?page_url=http://php-princess.net/2003/07/20/rand-function-in-mysql/&amp;title=RAND%28%29+function+in+MySql" rel="" class="external" title="Share this on Mixx">Share this on Mixx</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->

<img src="http://php-princess.net/?ak_action=api_record_view&id=120&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://php-princess.net/2003/07/20/rand-function-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
