<?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>MaggsWeb:7 &#187; MySQL</title>
	<atom:link href="http://www.maggsweb.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maggsweb.com</link>
	<description>www.maggsweb.com</description>
	<lastBuildDate>Sat, 21 Aug 2010 20:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MySQL Authentication in .htaccess</title>
		<link>http://www.maggsweb.com/mysql/mysql-authentication-in-htaccess/</link>
		<comments>http://www.maggsweb.com/mysql/mysql-authentication-in-htaccess/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 08:25:24 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[htaccess]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=399</guid>
		<description><![CDATA[Not tried and tested by me (yet) but I am assured that this is the way to do do this&#8230; ?View Code APACHE&#160; AuthName &#34;MySQL Authentication&#34; AuthType Basic &#160; AuthMySQLHost localhost AuthMySQLUser accesssecurity AuthMySQLPassword DBPWD AuthMySQLDB accesssecurity &#160; AuthMySQLUserTable users AuthMySQLNameField username AuthMySQLPasswordField password AuthMySQLPwEncryption none &#160; AuthMySQLUserCondition &#34;user_status=1&#34; AuthMySQLAuthoritative On AuthMySQLEnable On &#160; require [...]]]></description>
			<content:encoded><![CDATA[<p>Not tried and tested by me (yet) but I am assured that this is the way to do do this&#8230;<br />
<span id="more-399"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p399code2'); return false;">View Code</a> APACHE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3992"><td class="code" id="p399code2"><pre class="apache" style="font-family:monospace;">&nbsp;
<span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;MySQL Authentication&quot;</span>
<span style="color: #00007f;">AuthType</span> Basic
&nbsp;
AuthMySQLHost localhost
AuthMySQLUser accesssecurity
AuthMySQLPassword DBPWD
AuthMySQLDB accesssecurity
&nbsp;
AuthMySQLUserTable users
AuthMySQLNameField username
AuthMySQLPasswordField password
AuthMySQLPwEncryption <span style="color: #0000ff;">none</span>
&nbsp;
AuthMySQLUserCondition <span style="color: #7f007f;">&quot;user_status=1&quot;</span>
AuthMySQLAuthoritative <span style="color: #0000ff;">On</span>
AuthMySQLEnable <span style="color: #0000ff;">On</span>
&nbsp;
<span style="color: #00007f;">require</span> valid-<span style="color: #00007f;">user</span>
&nbsp;
<span style="color: #00007f;">DirectoryIndex</span> index.html
&nbsp;
<span style="color: #00007f;">ErrorDocument</span> <span style="color: #ff0000;">401</span> /errors/error_not_authenticated.html
<span style="color: #00007f;">ErrorDocument</span> <span style="color: #ff0000;">403</span> /errors/error_forbidden.html
<span style="color: #00007f;">ErrorDocument</span> <span style="color: #ff0000;">404</span> /errors/error_not_found.html
<span style="color: #00007f;">ErrorDocument</span> <span style="color: #ff0000;">500</span> /errors/error_oops.html</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/mysql/mysql-authentication-in-htaccess/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL Database backup</title>
		<link>http://www.maggsweb.com/php/mysql-database-backup/</link>
		<comments>http://www.maggsweb.com/php/mysql-database-backup/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 20:44:09 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://tech.maggsweb.co.uk/?p=298</guid>
		<description><![CDATA[Backing up a MySQL database using PHP. ?View Code PHP&#60;?php &#160; // Enter Database access details &#160; $host= 'dbxx.oneandone.co.uk'; $user= 'dbxxxxxx'; $pass= 'xxxxxxxx'; $db= 'dbxxxxxxx'; $filename= getenv&#40;'DOCUMENT_ROOT'&#41;.'/'.date&#40;'Y'&#41;.'-'.date&#40;'M'&#41;.'-'.date&#40;'D'&#41;; &#160; // Instructing the system to zip and store the database &#160; system&#40;sprintf&#40; 'mysqldump --opt -h%s -u%s -p%s %s &#124; gzip &#62; %s.sql.gz', $host, $user, $pass, $db, $filename [...]]]></description>
			<content:encoded><![CDATA[<p>Backing up a MySQL database using PHP.<br />
<span id="more-298"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p298code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2984"><td class="code" id="p298code4"><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;">// Enter Database access details</span>
&nbsp;
  <span style="color: #000088;">$host</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'dbxx.oneandone.co.uk'</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$user</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'dbxxxxxx'</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$pass</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'xxxxxxxx'</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$db</span><span style="color: #339933;">=</span>   <span style="color: #0000ff;">'dbxxxxxxx'</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$filename</span><span style="color: #339933;">=</span> <a href="http://www.php.net/getenv" onclick="pageTracker._trackPageview('/outgoing/www.php.net/getenv?referer=');"><span style="color: #990000;">getenv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DOCUMENT_ROOT'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><a href="http://www.php.net/date" onclick="pageTracker._trackPageview('/outgoing/www.php.net/date?referer=');"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">.</span><a href="http://www.php.net/date" onclick="pageTracker._trackPageview('/outgoing/www.php.net/date?referer=');"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'M'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">.</span><a href="http://www.php.net/date" onclick="pageTracker._trackPageview('/outgoing/www.php.net/date?referer=');"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Instructing the system to zip and store the database</span>
&nbsp;
  <a href="http://www.php.net/system" onclick="pageTracker._trackPageview('/outgoing/www.php.net/system?referer=');"><span style="color: #990000;">system</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/sprintf" onclick="pageTracker._trackPageview('/outgoing/www.php.net/sprintf?referer=');"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'mysqldump --opt -h%s -u%s -p%s %s | gzip &gt; %s.sql.gz'</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$host</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$user</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$pass</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$db</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$filename</span>  
  <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'+DONE'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>I haven&#8217;t actually tried this one yet.  The one I use is similar and works with the &#8216;exec&#8217; command &#8211; so this one is a much better function.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/mysql-database-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Head in the clouds? Tag yourself.</title>
		<link>http://www.maggsweb.com/php/head-in-the-clouds-tag-yourself/</link>
		<comments>http://www.maggsweb.com/php/head-in-the-clouds-tag-yourself/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 12:21:21 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[tag cloud]]></category>

		<guid isPermaLink="false">http://www.cmaggs.co.uk/?p=42</guid>
		<description><![CDATA[I have been looking for a &#8216;simple&#8217; tag cloud generator that will parse content from MySQL for ages and couldn&#8217;t find one. So I adapted &#8211; and heavily modified (reduced) &#8211; and CSS&#8217;d &#8211; the best one that I could find. It turned out nice and simple. ?View Code CSS .size9 &#123; color: #000; font-size: [...]]]></description>
			<content:encoded><![CDATA[<p>I have been looking for a &#8216;simple&#8217; tag cloud generator that will parse content from MySQL for ages and couldn&#8217;t find one.  So I adapted &#8211; and heavily modified (reduced) &#8211; and CSS&#8217;d &#8211; the best one that I could find.  It turned out nice and simple.<br />
<span id="more-273"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p273code7'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2737"><td class="code" id="p273code7"><pre class="css" style="font-family:monospace;">  <span style="color: #6666ff;">.size9</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">26px</span><span style="color: #00AA00;">;</span>	 <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size8</span> <span style="color: #00AA00;">&#123;</span> 	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#111</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">24px</span><span style="color: #00AA00;">;</span>	 <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size7</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">22px</span><span style="color: #00AA00;">;</span>	 <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size6</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>	<span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size5</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#444</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">18px</span><span style="color: #00AA00;">;</span>	<span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size4</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#555</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size3</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#666</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size2</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#777</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size1</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#888</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span>
  <span style="color: #6666ff;">.size0</span> <span style="color: #00AA00;">&#123;</span>	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span>	  <span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p><br/></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p273code8'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2738"><td class="code" id="p273code8"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$terms</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$maximum</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query" onclick="pageTracker._trackPageview('/outgoing/www.php.net/mysql_query?referer=');"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT word, count FROM [tablename] WHERE display = '1'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// could add LIMIT, SORT, etc.. if required</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_fetch_array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/mysql_fetch_array?referer=');"><span style="color: #990000;">mysql_fetch_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//create vars</span>
    <span style="color: #000088;">$word</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'word'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// set 'maximum' from counter</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$count</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$maximum</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$maximum</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$count</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//create array</span>
    <span style="color: #000088;">$elements</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'word'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$word</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'count'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$count</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//random</span>
<span style="color: #666666; font-style: italic;">//shuffle($elements);</span>
<span style="color: #666666; font-style: italic;">//alphabetical</span>
<a href="http://www.php.net/sort" onclick="pageTracker._trackPageview('/outgoing/www.php.net/sort?referer=');"><span style="color: #990000;">sort</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$elements</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$elements</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// start looping through the tags</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// determine the popularity of this term as a percentage</span>
    <span style="color: #000088;">$percent</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/floor" onclick="pageTracker._trackPageview('/outgoing/www.php.net/floor?referer=');"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$maximum</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// determine the class for this term based on the percentage</span>
	<span style="color: #b1b100;">if</span> 	   <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">99</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">70</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">8</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">7</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">40</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$percent</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>		<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>						<span style="color: #000088;">$class</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// output this term</span>
    <span style="color: #666666; font-style: italic;">//with links...</span>
    <span style="color: #666666; font-style: italic;">//echo &quot;&lt;span class=\&quot;$class\&quot;&gt;&lt;a href=\&quot;search.php?search=&quot; . urlencode($k['term']) . &quot;\&quot;&gt;&quot; . $k['term'] . &quot;&lt;/a&gt;&lt;/span&gt;\n &quot;;</span>
  <span style="color: #666666; font-style: italic;">//without links.../</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;span class='word size&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$class</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$e</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'word'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/span&gt;<span style="color: #000099; font-weight: bold;">\n</span> &quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// for debugging....</span>
<span style="color: #666666; font-style: italic;">//echo &quot;&lt;hr /&gt;&quot;;</span>
<span style="color: #666666; font-style: italic;">//echo &quot;&lt;pre&gt;&quot;;</span>
<span style="color: #666666; font-style: italic;">//print_r($elements);</span>
<span style="color: #666666; font-style: italic;">//echo &quot;</span></pre></td></tr></table></div>

<p>&#8220;;<br />
?>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/head-in-the-clouds-tag-yourself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL database connection</title>
		<link>http://www.maggsweb.com/php/function-dbconnect/</link>
		<comments>http://www.maggsweb.com/php/function-dbconnect/#comments</comments>
		<pubDate>Thu, 02 Jun 2005 20:50:05 +0000</pubDate>
		<dc:creator>chris</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://www.cmaggs.co.uk/?p=13</guid>
		<description><![CDATA[This handy little script can be used as a function as required, or in an include. I have used this on virtually every site that uses a a database connection. ?View Code PHP&#60;?php $DBHOST = ' '; $DBNAME = ' '; $DBUSER = ' '; $DBPASSWORD = ' '; &#160; function dbconnect&#40;&#41; &#123; global $DBHOST, [...]]]></description>
			<content:encoded><![CDATA[<p>This handy little script can be used as a function as required, or in an include.  I have used this on virtually every site that uses a a database connection.</p>
<p><span id="more-13"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p13code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1310"><td class="code" id="p13code10"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$DBHOST</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$DBNAME</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$DBUSER</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$DBPASSWORD</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> dbconnect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$DBHOST</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DBNAME</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DBUSER</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DBPASSWORD</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DBERROR</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><a href="http://www.php.net/mysql_pconnect" onclick="pageTracker._trackPageview('/outgoing/www.php.net/mysql_pconnect?referer=');"><span style="color: #990000;">mysql_pconnect</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DBHOST</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DBUSER</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DBPASSWORD</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><a href="http://www.php.net/mysql_select_db" onclick="pageTracker._trackPageview('/outgoing/www.php.net/mysql_select_db?referer=');"><span style="color: #990000;">mysql_select_db</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DBNAME</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</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;">&quot;ERROR: Cannot select database.&quot;</span><span style="color: #339933;">;</span>
      <a href="http://www.php.net/exit" onclick="pageTracker._trackPageview('/outgoing/www.php.net/exit?referer=');"><span style="color: #990000;">exit</span></a><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</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;">&quot;ERROR: Cannot connect to database server.&quot;</span><span style="color: #339933;">;</span>
    <a href="http://www.php.net/exit" onclick="pageTracker._trackPageview('/outgoing/www.php.net/exit?referer=');"><span style="color: #990000;">exit</span></a><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/function-dbconnect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
