<?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>Bloggeh.com &#187; MySQL</title>
	<atom:link href="http://www.bloggeh.com/category/web-development/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bloggeh.com</link>
	<description>Bits and pieces</description>
	<lastBuildDate>Mon, 31 May 2010 12:45:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MySQL GUI &#8211; Presenting HeidiSQL!</title>
		<link>http://www.bloggeh.com/2008/08/20/mysql-gui-presenting-heidisql/</link>
		<comments>http://www.bloggeh.com/2008/08/20/mysql-gui-presenting-heidisql/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 08:05:47 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.bloggeh.com/2008/08/20/mysql-gui-presenting-heidisql/</guid>
		<description><![CDATA[http://www.heidisql.com/download.php
Best I&#8217;ve found so far, smashing MySQL&#8217;s official query builder and dev tools.
So far easier to work with day-to-day than PHPMyAdmin
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.heidisql.com/download.php">http://www.heidisql.com/download.php</a></p>
<p>Best I&#8217;ve found so far, smashing MySQL&#8217;s official query builder and dev tools.</p>
<p>So far easier to work with day-to-day than PHPMyAdmin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggeh.com/2008/08/20/mysql-gui-presenting-heidisql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP With MYSQL Essential Training Notes</title>
		<link>http://www.bloggeh.com/2008/03/18/php-with-mysql-essential-training-notes/</link>
		<comments>http://www.bloggeh.com/2008/03/18/php-with-mysql-essential-training-notes/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 13:45:21 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.bloggeh.com/2008/03/18/php-with-mysql-essential-training-notes/</guid>
		<description><![CDATA[After completing the Lynda.com recent PHP and MySQL training series, these are the notes that I&#8217;ve taken. Hopefully they can serve as a useful reference for you like they have me!
The difference between single and double quotes
Its better to use double quotes.

You can add variables into      double quotes and it [...]]]></description>
			<content:encoded><![CDATA[<p>After completing the Lynda.com recent PHP and MySQL training series, these are the notes that I&#8217;ve taken. Hopefully they can serve as a useful reference for you like they have me!</p>
<h2><span lang="EN-US">The difference between single and double quotes<o:p></o:p></span></h2>
<p class="MsoNormal"><span lang="EN-US">Its better to use double quotes.<o:p></o:p></span></p>
<ul style="margin-top: 0cm" type="disc">
<li class="MsoNormal"><span lang="EN-US">You can add variables into      double quotes and it will output the variable value.<o:p></o:p></span></li>
<li class="MsoNormal"><span lang="EN-US">You can surround a variable in      curly braces and it will still output the variable value<o:p></o:p></span></li>
</ul>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Single quotes will output the variable name.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<h2><span lang="EN-US">String Functions<o:p></o:p></span></h2>
<table class="MsoTableGrid" style="border: medium none ; border-collapse: collapse" border="1" cellpadding="0" cellspacing="0" height="53" width="360">
<tr>
<td colspan="2" style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 446.4pt" valign="top" width="595">
<p class="MsoNormal"><span class="Code"><span>$string   = â€œThe quick brown fox jumped over the lazy dogâ€<o:p></o:p></span></span></p>
</td>
</tr>
<tr>
<td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 183.65pt" valign="top" width="245">
<p class="MsoNormal"><span class="Code"><span>.=<o:p></o:p></span></span></p>
</td>
<td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 262.75pt" valign="top" width="350">
<p class="MsoNormal"><span lang="EN-US">Concatenates   a string<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 183.65pt" valign="top" width="245">
<p class="MsoNormal"><span class="Code"><span>str_repeat($string,2);<o:p></o:p></span></span></p>
</td>
<td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 262.75pt" valign="top" width="350">
<p class="MsoNormal"><span lang="EN-US">Repeats a   string twice<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 183.65pt" valign="top" width="245">
<p class="MsoNormal"><span class="Code"><span>strpos($string,â€brownâ€);<o:p></o:p></span></span></p>
</td>
<td style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 262.75pt" valign="top" width="350">
<p class="MsoNormal"><span lang="EN-US">Finds the   position of the string<o:p></o:p></span></p>
</td>
</tr>
</table>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<h2><span lang="EN-US"><o:p> </o:p></span></h2>
<h2><span lang="EN-US">There is two types of numbers:<o:p></o:p></span></h2>
<ul style="margin-top: 0cm" type="disc">
<li class="MsoNormal"><span lang="EN-US">Integers (whole numbers)<o:p></o:p></span></li>
<li class="MsoNormal"><span lang="EN-US">Floating point numbers      (decimals)<o:p></o:p></span></li>
</ul>
<h2><span lang="EN-US">Manipulating Numbers<o:p></o:p></span></h2>
<p class="MsoNormal">Increment:<span class="Code"><span lang="EN-US"> $var++<o:p></o:p></span></span></p>
<p class="MsoNormal">Decrement:<span class="Code"><span lang="EN-US"> $var&#8211;<o:p></o:p></span></span></p>
<p class="MsoNormal">Random number:<span class="Code"><span lang="EN-US"> rand()<o:p></o:p></span></span></p>
<p class="MsoNormal">Random number with min/max:<span class="Code"><span lang="EN-US"> rand(1,10)<o:p></o:p></span></span></p>
<h2>Float point Numbers</h2>
<p class="MsoNormal">Floating point numbers are Decimal numbers! Ie. 3.14</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>$myfloat = 3.143864<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>Round($myfloat,2);</span></span> would produce <span class="Code"><span>3.14<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<h2><span class="Code"><span style="font-family: Arial">Arrays<o:p></o:p></span></span></h2>
<p class="MsoNormal"><span class="Code"><span>print_r($array)</span></span> will display all variables in an array</p>
<p class="MsoNormal">if you surround it with <span class="Code"><span>&lt;pre&gt; &lt;/pre&gt; </span></span><span> </span>tags it will display them nicely formatted.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>in_array(needle,haystack)</span></span> checks for an item in an array</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>Boolean &amp; NULL</h2>
<p class="MsoNormal">Boolean means true or false, 1 or 0 (respectively).</p>
<p class="MsoNormal"><span class="Code"><span>Isset($variable)</span></span> tests the Boolean state of a variable and returns true or false</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>empty($variable)</span></span> is similar to the opposite of <span class="Code"><span>isset($var)</span></span>.However it will return TRUE for the value 0 in both integer and string format (also NULL).</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>Constants</h2>
<p class="MsoNormal">Similar to variables however they do not change!</p>
<p class="MsoNormal"><span class="Code"><span>define(â€œMAX_WIDTHâ€, 980);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>echo MAX_WIDTH;<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>If &amp; Else statements</h2>
<p class="MsoNormal">When using <span class="Code"><span>if</span></span>, and <span class="Code"><span>elseif</span></span> statements, the final <span class="Code"><span>else</span></span> will be the default if none of the <span class="Code"><span>if</span></span> and <span class="Code"><span>elseif</span></span> statements are true.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>Switch Statements</h2>
<p class="MsoNormal">Use when you need to test one variable, instead of writing many if / else statements.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Make sure you use <span class="Code"><span>break </span></span>in the code or it will continue to search through the conditions</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>Switch ($a) {<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><span>     </span>case 0:<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><span>          </span>echo â€œhiâ€;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><span>          </span>break;<span>    </span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>}<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>3 Different types of loops: While, For &amp; Foreach</h2>
<h3>While Loops</h3>
<p class="MsoNormal"><span class="Code"><span>$count = 0<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>while ($count &lt;= 10) {<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><span>     </span>echo $count;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><span>     </span>$count++;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>}<o:p></o:p></span></span></p>
<h3>For Loops</h3>
<p class="MsoNormal">Same as while loops.</p>
<p class="MsoNormal">Format is:</p>
<p class="MsoNormal"><span class="Code"><span>for (initial, test, each) {statement;}<o:p></o:p></span></span></p>
<p class="MsoNormal">example: <span class="Code"><span>for ($count, $count &lt;= 10; $count++) {echo $count . â€œ&lt;br /&gt;â€; }<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h3>Foreach Loops (only used on arrays!!)</h3>
<p class="MsoNormal">This is how you use each value</p>
<p class="MsoNormal"><span class="Code"><span>foreach ($array as $value) { statement; }<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<p class="MsoNormal">You can also loop through key, value pairs</p>
<p class="MsoNormal"><span class="Code"><span>foreach ($array as $key =&gt; $value) {statement;}<o:p></o:p></span></span></p>
<h3> Pointers</h3>
<p class="MsoNormal">To find the current position of the pointer in an array</p>
<p class="MsoNormal"><span class="Code"><span>current($array);<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Move to the next position in an array</p>
<p class="MsoNormal"><span class="Code"><span>next($array);<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Reset the pointer in an array</p>
<p class="MsoNormal"><span class="Code"><span>reset($array);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<p class="MsoNormal">Using a while loop that moves the array pointer (similar to what you would do processing rows that are returned from a database)</p>
<p class="MsoNormal"><span class="Code"><span>$ages = array(4,8,15,22,29,33,52);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>while ($age = current($ages)) {</span></span> // this will loop while it can successfully assign an age from</p>
<p class="MsoNormal"><span class="Code"><span>statement;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>next($ages);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>}<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>User-Defined Functions</h2>
<p class="MsoNormal"><span class="Code"><span>function name($arguments) { statement; }<o:p></o:p></span></span></p>
<h3>Local Scope</h3>
<p class="MsoNormal">Variables defined within a function, act as if they only exist within the function.</p>
<h3>Global Scope</h3>
<p class="MsoNormal">If you define a variable using the <span> </span><span class="Code"><span>global $var <span> </span></span></span>syntax, then it will pull in variables outside of the function, and also make them available outside the function.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>3 Ways to get information from a user</h2>
<ol style="margin-top: 0cm" start="1" type="1">
<li class="MsoNormal">GET</li>
<li class="MsoNormal">POST</li>
<li class="MsoNormal">COOKIE</li>
</ol>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>Passing variables through GET &amp; URLEncode</h2>
<p class="MsoNormal">If you want to pass a character such as an ampersand (&amp;) or space, you can include php in the link to <span class="Code"><span>urlencode</span></span> the characters. For example:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>&lt;a href=â€test.php?name=&lt;?php echo urlencode(â€œdavid&amp;â€) ?&gt;&amp;surname=maraâ€&gt; Link &lt;/a&gt;<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><strong>You only need to encode when using GET. Not with POST.<o:p></o:p></strong></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If you want to dynamically create an entire link, use <span class="Code"><span>rawurlencode($string)</span></span> for everything before the <span class="Code"><span>?</span></span> in a link, and <span class="Code"><span>urlencode($string)</span></span> for everything after.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>Cookies</h2>
<p class="MsoNormal"><span class="Code"><span>setcookie($name, $value, $expire);<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Must come before ANY html, white space, tabs etc.. on a page.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>Headers (and Page ReDirection),</h2>
<p class="MsoNormal">Must come before ANY html, white space, tabs etc.. on a page.</p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<p class="MsoNormal">Format:</p>
<p class="MsoNormal"><span class="Code"><span>header(header information);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<p class="MsoNormal">How to write a page re-direct.</p>
<p class="MsoNormal"><span class="Code"><span>header(â€œLocation: page.htmlâ€);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>exit;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<h3>Output Buffering</h3>
<p class="MsoNormal">Output buffering basically means that you can store up all the information of the page, and send it in one hit. This allows you to have headers appear in the body text of a page. This kind of â€˜convenienceâ€™ comes at this cost of performance.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You can enable Output Buffering in the PHP.ini file.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You can also enable it without editing the PHP.ini file. You can do it within PHP.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>ob_start();</span></span> // has to appear before any HTML is output if weâ€™re sending headers</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>ob_end_flush();<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span><o:p> </o:p></span></span></p>
<h2><span class="Code"><span>CRUD â€“ Create, Read, Update, Delete<o:p></o:p></span></span></h2>
<h3>Read</h3>
<p class="MsoNormal"><span class="Code"><span>SELECT * FROM table WHERE column1 = â€˜some_textâ€™ ORDER BY column1, column2 ASC;</span></span><span style="font-family: 'Courier New'"><o:p></o:p></span></p>
<h3>Create</h3>
<p class="MsoNormal"><span class="Code"><span>INSERT INTO table (column1, column2, column3) VALUES (val1, val2, val3);<o:p></o:p></span></span></p>
<p class="MsoNormal">Note: Strings must have single quotes â€˜ around them.</p>
<h3>Update</h3>
<p class="MsoNormal"><span class="Code"><span>UPDATE table SET column1 = â€˜some_textâ€™ WHERE id = 1;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="Code"><span>mysql_affected_rows() </span></span>will tell you how many rows were affected in the last update.</p>
<h3>Delete</h3>
<p class="MsoNormal"><span class="Code"><span>DELETE FROM table WHERE id = 1;<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>PHP Database Interaction in FIVE steps</h2>
<h3>1. Create a connection</h3>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span>$connection = mysql_connect(&#8220;localhost&#8221;, &#8220;root&#8221;, &#8220;password&#8221;);<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span><o:p> </o:p></span></span></p>
<h3>2. Select a database</h3>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span>$db_select = mysql_select_db(&#8220;widget_corp&#8221;, $connection);<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span><o:p> </o:p></span></span></p>
<h3>3. Perform database query</h3>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span>$result = mysql_query(&#8220;SELECT * FROM subjects&#8221;, $connection);<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span><o:p> </o:p></span></span></p>
<h3>4. Use returned data (if any)</h3>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span>while ($row = mysql_fetch_array($result)) { <o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span><span>  </span>echo $row['menu_name'] . &#8221; &#8221; . $row['position'] . &#8220;&lt;br /&gt;&#8221;;<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span>}<o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span><o:p> </o:p></span></span></p>
<h3>5. Close connection</h3>
<p class="MsoNormal" style="margin-left: 18pt"><span class="Code"><span>mysql_close($connection);<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>The 10 Essential MySQL commands</h2>
<h3>1. mysql_connect</h3>
<p class="MsoNormal">Connects to a MySQL server</p>
<h3>2. mysql_select_db</h3>
<p class="MsoNormal">Selects a database</p>
<h3>3. mysql_query</h3>
<p class="MsoNormal">Used to query the database</p>
<h3>4. mysql_error</h3>
<p class="MsoNormal">You can echo mysql_error() to get the error returned by mysql</p>
<h3>5. mysql_close</h3>
<p class="MsoNormal">Close a MySQL connection</p>
<h3>6. mysql_fetch_array</h3>
<p class="MsoNormal">Retrieves the records in an array (can be accessed using associative keys)</p>
<p class="MsoNormal">Remember you have to loop through each record in the array.</p>
<h3>7. mysql_num_rows</h3>
<p class="MsoNormal">Retrieves the number of record rows retrieved from a query</p>
<h3>8. mysql_affected_rows</h3>
<p class="MsoNormal">Shows the affected number of rows from a query</p>
<h3>9. mysql_real_escape_string</h3>
<p class="MsoNormal">Escapes dangerous characters from entering your database</p>
<h3>10. mysql_insert_id</h3>
<p class="MsoNormal">Tells you the last inserted ID.</p>
<h2><o:p> </o:p></h2>
<h3><o:p> </o:p></h3>
<p><strong><em><span style="font-size: 14pt; font-family: Arial"><br style="page-break-before: always" clear="all" /> </span></em></strong></p>
<h2>Text encoding and transformation</h2>
<p class="MsoNormal">Anything you output to the browser should go through <span class="Code"><span>htmlentities </span></span>especially if itâ€™s coming from a database where users have entered the data.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h3>htmlentities()</h3>
<p class="MsoNormal">Converts any special characters to %lt; (html entities!)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h3>strip_tags()</h3>
<p class="MsoNormal">strips all html tags from text. You can allow specific tags as required:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span class="Code"><span>strip_tags($content, â€œ&lt;b&gt;&lt;br&gt;&lt;p&gt;&lt;a&gt;â€);<o:p></o:p></span></span></p>
<p class="MsoNormal">This would allow the bold, break, paragraph and link tags to be the only html formatting on this text.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<h3>nl2br()</h3>
<p class="MsoNormal"><span class="Code"><span>nl2br($content);</span></span> will preserve any â€˜entersâ€™ or new lines in the text entered by the user.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p><strong><em><span style="font-size: 14pt; font-family: Arial"><br style="page-break-before: always" clear="all" /> </span></em></strong></p>
<h2>Login / Authorisation</h2>
<p class="MsoNormal">When structuring your query string to search if a username/password is correct in a database, do NOT select * information and return that. This is insecure and you do not need the password returned. Instead return perhaps the id and the username and any other information you will require.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><strong>Incorrect Auth Check:<o:p></o:p></strong></p>
<p class="MsoNormal"><span class="Code"><span>$query = &#8220;SELECT * FROM users WHERE username = &#8216;{$username}&#8217; AND hashed_password = &#8216;{$hashed_password}&#8217;&#8221;;<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><strong>Correct Auth Check:<o:p></o:p></strong></p>
<p class="MsoNormal"><span class="Code"><span>$query = &#8220;SELECT id, username FROM users WHERE username = &#8216;{$username}&#8217; AND hashed_password = &#8216;{$hashed_password}&#8217;&#8221;;<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-size: 12pt; font-family: Arial"><br style="page-break-before: always" clear="all" /> </span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2><o:p> </o:p></h2>
<h2>Building an Application (CMS)</h2>
<ol style="margin-top: 0cm" start="1" type="1">
<li class="MsoNormal">Blue      printing</li>
<li class="MsoNormal">Build      databases</li>
<li class="MsoNormal">Build      the folder structure</li>
<li class="MsoNormal">Build      layout</li>
<li class="MsoNormal">Build      navigation</li>
<li class="MsoNormal">Setup      page layout using includes/requires</li>
<li class="MsoNormal">Break      the pages into chunks and start building!</li>
</ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<h2>Things to keep in mind</h2>
<ul style="margin-top: 0cm" type="disc">
<li class="MsoNormal">Donâ€™t      spend too much time refactoring or anything like that, find the balance      between â€˜perfect practiceâ€™ and â€˜efficiencyâ€™. Donâ€™t always go over-kill or      youâ€™ll never finish.</li>
<li class="MsoNormal">Donâ€™t      repeat yourself coding</li>
<li class="MsoNormal">Use      htaccess to limit access to files which contain database logins/password      details</li>
<li class="MsoNormal">Refactoring      â€“ improving your code</li>
<li class="MsoNormal">Use      htaccess to limit access to your include files.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggeh.com/2008/03/18/php-with-mysql-essential-training-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Correct Database Design &#8211; Normalisation</title>
		<link>http://www.bloggeh.com/2008/03/05/correct-database-design-normalisation/</link>
		<comments>http://www.bloggeh.com/2008/03/05/correct-database-design-normalisation/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 01:02:22 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Site Optimisation]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.bloggeh.com/2008/03/05/correct-database-design-normalisation/</guid>
		<description><![CDATA[A must read before you go creating any SQL/MySQL or whatever database
http://www.peachpit.com/articles/article.aspx?p=30885 
]]></description>
			<content:encoded><![CDATA[<p>A must read before you go creating any SQL/MySQL or whatever database</p>
<p><a href="http://www.peachpit.com/articles/article.aspx?p=30885" target="_blank">http://www.peachpit.com/articles/article.aspx?p=30885 </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggeh.com/2008/03/05/correct-database-design-normalisation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write a Database Class in PHP5</title>
		<link>http://www.bloggeh.com/2007/11/13/how-to-write-a-database-class-in-php5/</link>
		<comments>http://www.bloggeh.com/2007/11/13/how-to-write-a-database-class-in-php5/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 12:21:52 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.bloggeh.com/2007/11/13/how-to-write-a-database-class-in-php5/</guid>
		<description><![CDATA[http://stephensaine.com/?p=6
]]></description>
			<content:encoded><![CDATA[<p><a href="http://stephensaine.com/?p=6" title="How to Write a Database Class in PHP5" target="_blank">http://stephensaine.com/?p=6</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggeh.com/2007/11/13/how-to-write-a-database-class-in-php5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a user authentication system in PHP</title>
		<link>http://www.bloggeh.com/2007/11/13/building-a-user-authentication-system-in-php/</link>
		<comments>http://www.bloggeh.com/2007/11/13/building-a-user-authentication-system-in-php/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 11:12:00 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.bloggeh.com/2007/11/13/building-a-user-authentication-system-in-php/</guid>
		<description><![CDATA[Article linked here
]]></description>
			<content:encoded><![CDATA[<p><a href="http://allaboutruby.wordpress.com/2006/08/26/building-a-user-authorization-system-in-php-part-i/" title="Building a User Authentication System in PHP" target="_blank">Article linked here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloggeh.com/2007/11/13/building-a-user-authentication-system-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
