<?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>James Northard</title>
	<atom:link href="http://www.jamesnorthard.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamesnorthard.com</link>
	<description>Business &#38; Technology Developer</description>
	<lastBuildDate>Tue, 15 May 2012 19:55:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Troubleshooting PHP Warning: Cannot modify header information &#8211; headers already sent</title>
		<link>http://www.jamesnorthard.com/troubleshooting-php-warning-cannot-modify-header-information-headers-already-sent/</link>
		<comments>http://www.jamesnorthard.com/troubleshooting-php-warning-cannot-modify-header-information-headers-already-sent/#comments</comments>
		<pubDate>Tue, 15 May 2012 19:49:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[cannot]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[information]]></category>
		<category><![CDATA[modify]]></category>
		<category><![CDATA[ob_flush]]></category>
		<category><![CDATA[ob_start]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=230</guid>
		<description><![CDATA[Add the following code to the top of your page: &#60;?php ob_start&#40;&#41;; ?&#62; And add this code to the bottom of your page: &#60;?php ob_flush&#40;&#41;; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>Add the following code to the top of your page:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p>And add this code to the bottom of your page:<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">ob_flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/troubleshooting-php-warning-cannot-modify-header-information-headers-already-sent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Query a Database or String for Specific Word(s)</title>
		<link>http://www.jamesnorthard.com/how-to-query-a-database-or-string-for-specific-words/</link>
		<comments>http://www.jamesnorthard.com/how-to-query-a-database-or-string-for-specific-words/#comments</comments>
		<pubDate>Mon, 30 Apr 2012 19:02:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Specific Words]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Variable]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=220</guid>
		<description><![CDATA[Query from database &#60;?php $query = 'SELECT * FROM table WHERE field LIKE %variable%' ?&#62; Query from string &#60;?php$statement = 'Hello, how are you doing today?';//Checks string for the word &#34;are&#34;$query = 'if (strpos($statement,'are') !== false) {&#160;&#160;&#160;&#160;echo 'true';}?&#62;]]></description>
			<content:encoded><![CDATA[<p><strong>Query from database</strong></p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT * FROM table WHERE field LIKE %variable%'</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
<p><strong>Query from string</strong></p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #000000; font-weight: bold;">&lt;?php</span></li><li><span style="color: #000088;">$statement</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Hello, how are you doing today?'</span><span style="color: #339933;">;</span></li><li><span style="color: #666666; font-style: italic;">//Checks string for the word &quot;are&quot;</span></li><li><span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'if (strpos($statement,'</span>are<span style="color: #0000ff;">') !== false) {</span></li><li><span style="color: #0000ff;">&nbsp;&nbsp;&nbsp;&nbsp;echo '</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #0000ff;">';</span></li><li><span style="color: #0000ff;">}</span></li><li><span style="color: #0000ff;">?&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/how-to-query-a-database-or-string-for-specific-words/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export MySQL to Excel Using PHP</title>
		<link>http://www.jamesnorthard.com/export-mysql-to-excel-using-php/</link>
		<comments>http://www.jamesnorthard.com/export-mysql-to-excel-using-php/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 21:48:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Export]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=210</guid>
		<description><![CDATA[The code below will export every column name and value from your database into an excel document. Note: Delete the line spaces if you receive a parse error. &#60;?php/*******EDIT LINES 3-8*******/$DB_Server = &#34;localhost&#34;; //MySQL Server $DB_Username = &#34;username&#34;; //MySQL Username $DB_Password = &#34;password&#34;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //MySQL Password $DB_DBName = &#34;databasename&#34;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //MySQL Database Name $DB_TBLName = &#34;tablename&#34;; //MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>The code below will export every column name and value from your database into an excel document.</p>
<p>Note: Delete the line spaces if you receive a parse error.</p>
<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">&lt;?php</span></li><li><span style="color: #666666; font-style: italic;">/*******EDIT LINES 3-8*******/</span></li><li><span style="color: #000088;">$DB_Server</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//MySQL Server </span></li><li><span style="color: #000088;">$DB_Username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;username&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//MySQL Username </span></li><li><span style="color: #000088;">$DB_Password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;password&quot;</span><span style="color: #339933;">;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #666666; font-style: italic;">//MySQL Password </span></li><li><span style="color: #000088;">$DB_DBName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;databasename&quot;</span><span style="color: #339933;">;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #666666; font-style: italic;">//MySQL Database Name </span></li><li><span style="color: #000088;">$DB_TBLName</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;tablename&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//MySQL Table Name</span></li><li><span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;excelfilename&quot;</span><span style="color: #339933;">;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #666666; font-style: italic;">//File Name</span></li><li><span style="color: #666666; font-style: italic;">/*******YOU DO NOT NEED TO EDIT ANYTHING BELOW THIS LINE*******/</span></li><li><span style="color: #666666; font-style: italic;">//create MySQL connection</span></li><li><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Select * from <span style="color: #006699; font-weight: bold;">$DB_TBLName</span>&quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$Connect</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DB_Server</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DB_Username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DB_Password</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Couldn't connect to MySQL:&lt;br&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_errno</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #666666; font-style: italic;">//select database</span></li><li><span style="color: #000088;">$Db</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DB_DBName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$Connect</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Couldn't select database:&lt;br&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_errno</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #666666; font-style: italic;">//execute query</span></li><li><span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$Connect</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Couldn't execute query:&lt;br&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">mysql_errno</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #000088;">$file_ending</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;xls&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #666666; font-style: italic;">//header info for browser</span></li><li><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: application/xls&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: attachment; filename=<span style="color: #006699; font-weight: bold;">$filename</span>.xls&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Pragma: no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires: 0&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;</li><li><span style="color: #666666; font-style: italic;">/*******Start of Formatting for Excel*******/</span></li><li><span style="color: #666666; font-style: italic;">//define separator (defines columns in excel &amp; tabs in word)</span></li><li><span style="color: #000088;">$sep</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//tabbed character</span></li><li>&nbsp;</li><li><span style="color: #666666; font-style: italic;">//start of printing column names as names of MySQL fields</span></li><li><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">mysql_num_fields</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li><span style="color: #b1b100;">echo</span> <span style="color: #990000;">mysql_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #b1b100;">print</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #666666; font-style: italic;">//end of printing column names</span></li><li>&nbsp;</li><li><span style="color: #666666; font-style: italic;">//start while loop to get data</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000088;">$schema_insert</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span><span style="color: #339933;">&lt;</span><span style="color: #990000;">mysql_num_fields</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$j</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000088;">$schema_insert</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;NULL&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sep</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000088;">$schema_insert</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$row</span>[<span style="color: #006699; font-weight: bold;">$j</span>]&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sep</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">else</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000088;">$schema_insert</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sep</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000088;">$schema_insert</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sep</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$schema_insert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li> <span style="color: #000088;">$schema_insert</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>|<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>|<span style="color: #000099; font-weight: bold;">\n</span>|<span style="color: #000099; font-weight: bold;">\r</span>/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$schema_insert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000088;">$schema_insert</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">print</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$schema_insert</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li><span style="color: #000000; font-weight: bold;">?&gt;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/export-mysql-to-excel-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PCI Compliance &#8211; Simplified</title>
		<link>http://www.jamesnorthard.com/pci-compliance-simplified/</link>
		<comments>http://www.jamesnorthard.com/pci-compliance-simplified/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 20:57:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[compliance]]></category>
		<category><![CDATA[pci]]></category>
		<category><![CDATA[simplified]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=198</guid>
		<description><![CDATA[When making a payment online there is a merchant account and a gateway account. The merchant account is the bank account (where the money is deposited) and the gateway is the payment processor. So when you go to a website and fill in the information (name, address, credit card #, etc.) the gateway is verifying [...]]]></description>
			<content:encoded><![CDATA[<p>When making a payment online there is a merchant account and a gateway account. The merchant account is the bank account (where the money is deposited) and the gateway is the payment processor. So when you go to a website and fill in the information (name, address, credit card #, etc.) the gateway is verifying this information prior to depositing it into the merchant account. The Payment Card Industry (PCI) is an organization that requires certain measures to be met as far as security goes for the gateway account. The gateway can be fined or shut down by PCI for not being compliant with their standards, so the gateways contract out these third-party companies to ensure that all of their customers are compliant. If the company is not compliant, the gateway will add a fee to the account because they are taking a risk.</p>
<p><strong>Are you able to choose who your PCI compliance is verify through?</strong>: Yes and No. It depends what gateway account the company is using. All of these PCI standards are based on the volume of transactions. For companies that have a lot of transactions, there is a higher level of compliance that is required. A large (gateway) company they will typically contract out a company to handle these test and you need to verify compliance through them. The smaller companies (some banks provide gateways) only require a self-assessment which can be completed in about 5 minutes online. This assessment is also contracted out to third-party companies.</p>
<p>Once your client has become PCI compliant, they will no longer be charged the extra fee. The PCI compliance should also be built into the gateway fees, there should not be an extra charge to your client for this service.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/pci-compliance-simplified/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find and Replace in SQL</title>
		<link>http://www.jamesnorthard.com/find-and-replace-in-sql/</link>
		<comments>http://www.jamesnorthard.com/find-and-replace-in-sql/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 19:08:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hack]]></category>
		<category><![CDATA[Find and Replace]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=190</guid>
		<description><![CDATA[This is a very useful code for making edits on the fly, especially if you have extra spacing or quotes after importing values into your database. UPDATE tablename SET tablefield = REPLACE&#40;tablefield,'oldstring','newstring'&#41;;]]></description>
			<content:encoded><![CDATA[<p>This is a very useful code for making edits on the fly, especially if you have extra spacing or quotes after importing values into your database.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="SQL"><div class="devcodeoverflow"><ol><li><span style="color: #993333; font-weight: bold;">UPDATE</span> tablename <span style="color: #993333; font-weight: bold;">SET</span> tablefield <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>tablefield<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'oldstring'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'newstring'</span><span style="color: #66cc66;">&#41;</span>;</li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/find-and-replace-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Block IP Range using Wildcard with PHP</title>
		<link>http://www.jamesnorthard.com/block-ip-range-using-wildcard-with-php/</link>
		<comments>http://www.jamesnorthard.com/block-ip-range-using-wildcard-with-php/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 20:41:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Block IP]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Range]]></category>
		<category><![CDATA[Wildcard]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=184</guid>
		<description><![CDATA[// array's of banned IP addresses$bannedIP = array&#40;&#34;^10.999.00.*&#34;, &#34;^99.88.77.*&#34;, &#34;192.168.0.1&#34;, &#34;^66.77.*.*&#34;&#41;;if&#40;in_array&#40;$_SERVER&#91;'REMOTE_ADDR'&#93;,$bannedIP&#41;&#41; &#123;&#160;&#160;&#160;&#160; // this is for exact matches of IP address in array&#160;&#160;&#160;&#160; header&#40;&#34;Location: http://www.domain.com&#34;&#41;;&#160;&#160;&#160;&#160; exit&#40;&#41;;&#125; else &#123;&#160;&#160;&#160;&#160; // this is for wild card matches&#160;&#160;&#160;&#160; foreach&#40;$bannedIP as $ip&#41; &#123;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#40;eregi&#40;$ip,$_SERVER&#91;'REMOTE_ADDR'&#93;&#41;&#41; &#123;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; header&#40;&#34;Location: http://www.domain.com&#34;&#41;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; exit&#40;&#41;;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#125;&#160;&#160;&#160;&#160; &#125;&#125;]]></description>
			<content:encoded><![CDATA[<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #666666; font-style: italic;">// array's of banned IP addresses</span></li><li><span style="color: #000088;">$bannedIP</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;^10.999.00.*&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;^99.88.77.*&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;192.168.0.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;^66.77.*.*&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$bannedIP</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #666666; font-style: italic;">// this is for exact matches of IP address in array</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://www.domain.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #666666; font-style: italic;">// this is for wild card matches</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bannedIP</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$ip</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ip</span><span style="color: #339933;">,</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://www.domain.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #009900;">&#125;</span></li><li><span style="color: #009900;">&#125;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/block-ip-range-using-wildcard-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obtain a Users IP Address with PHP</title>
		<link>http://www.jamesnorthard.com/obtain-a-users-ip-address-using-php/</link>
		<comments>http://www.jamesnorthard.com/obtain-a-users-ip-address-using-php/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 16:17:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hack]]></category>
		<category><![CDATA[IP Address]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Users IP]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=180</guid>
		<description><![CDATA[if &#40; isset&#40;$_SERVER&#91;&#34;REMOTE_ADDR&#34;&#93;&#41; &#41;&#160;&#160;&#160;&#160;&#123; $userip = $_SERVER&#91;&#34;REMOTE_ADDR&#34;&#93;; &#125; else if &#40; isset&#40;$_SERVER&#91;&#34;HTTP_X_FORWARDED_FOR!&#34;&#93;&#41; &#41;&#160;&#160;&#160;&#160;&#123; $userip = $_SERVER&#91;&#34;HTTP_X_FORWARDED_FOR&#34;&#93;; &#125; else if &#40; isset&#40;$_SERVER&#91;&#34;HTTP_CLIENT_IP&#34;&#93;&#41; &#41;&#160;&#160;&#160;&#160;&#123; $userip = $_SERVER&#91;&#34;HTTP_CLIENT_IP&#34;&#93;; &#125; &#160; echo 'IP: '.$userip;]]></description>
			<content:encoded><![CDATA[<p><!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span> </li><li> <span style="color: #000088;">$userip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> </li><li> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_X_FORWARDED_FOR!&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span> </li><li> <span style="color: #000088;">$userip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_X_FORWARDED_FOR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> </li><li> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_CLIENT_IP&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #009900;">&#123;</span> </li><li> <span style="color: #000088;">$userip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_CLIENT_IP&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> </li><li> <span style="color: #009900;">&#125;</span> </li><li>&nbsp;</li><li> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'IP: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$userip</span><span style="color: #339933;">;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/obtain-a-users-ip-address-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update Checkbox Value Using PHP &amp; MySQL</title>
		<link>http://www.jamesnorthard.com/update-checkbox-value-using-php-mysql/</link>
		<comments>http://www.jamesnorthard.com/update-checkbox-value-using-php-mysql/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 15:57:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hack]]></category>
		<category><![CDATA[Checkbox Value]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=167</guid>
		<description><![CDATA[This code will send exactly two query&#8217;s to update a INT (0 or 1) checkbox field in a MySQL database. The IN operational statement let&#8217;s you match on a list of values in a clause. The implode statement will turn the array (shown below) into a string. &#60;?php if &#40;isset&#40;$_POST&#91;'doSave'&#93;&#41;&#41;&#123; if &#40;isset&#40;$_POST&#91;'checkbox'&#93;&#41;&#41;&#123; $doSave = implode&#40;',',$_POST&#91;'checkbox'&#93;&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>This code will send exactly two query&#8217;s to update a INT (0 or 1) checkbox field in a MySQL database.</p>
<p>The IN operational statement let&#8217;s you match on a list of values in a clause. The implode statement will turn the array (shown below) into a string.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li></li><li><span style="color: #000000; font-weight: bold;">&lt;?php</span></li><li>	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'doSave'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li> 		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'checkbox'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li>			<span style="color: #000088;">$doSave</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'checkbox'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>			<span style="color: #666666; font-style: italic;">//if checkbox IS checked, update the database with a value of 1</span></li><li>			 <span style="color: #000088;">$updatequery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;update databasename set checkbox='1' where id IN (<span style="color: #006699; font-weight: bold;">$doSave</span>)&quot;</span><span style="color: #339933;">;</span></li><li>			 <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$updatequery</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span>myql_error<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>			<span style="color: #666666; font-style: italic;">//if checkbox IS NOT checked, update the database with a value of 0</span></li><li>			 <span style="color: #000088;">$updatequery2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;update databasename set checkbox='0' where id NOT IN (<span style="color: #006699; font-weight: bold;">$doSave</span>)&quot;</span><span style="color: #339933;">;</span></li><li>			 <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$updatequery2</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span>myql_error<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></li><li>		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'checkbox'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></li><li>			<span style="color: #666666; font-style: italic;">//if checkbox IS NOT set, update the database with a value of 0</span></li><li>			 <span style="color: #000088;">$doSave</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'checkbox'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li>			 <span style="color: #000088;">$updatequery2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;update databasename set checkbox='0' where id NOT IN (<span style="color: #006699; font-weight: bold;">$doSave</span>)&quot;</span><span style="color: #339933;">;</span></li><li>			 <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$updatequery2</span><span style="color: #009900;">&#41;</span> or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span>myql_error<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></li><li>	<span style="color: #009900;">&#125;</span></li><li><span style="color: #000000; font-weight: bold;">?&gt;</span></li><li></li></ol></div></pre><!--END_DEVFMTCODE--><br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;formname&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span>&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--><br />
The checkboxes are populated through a while loop (not shown). Each checkbox has the same name, but a unique value. The $id variable is the unique field that is populated from the database. Include brackets [] in order to turn the field into an array.<br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$database</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'checkbox'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$set_checked</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CHECKED&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$set_checked</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></li><li>&nbsp;&nbsp;<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;input type=<span style="color: #000099; font-weight: bold;">\&quot;</span>checkbox<span style="color: #000099; font-weight: bold;">\&quot;</span> name=<span style="color: #000099; font-weight: bold;">\&quot;</span>checkbox[]<span style="color: #000099; font-weight: bold;">\&quot;</span> value=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$id</span><span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #006699; font-weight: bold;">$set_checked</span> /&gt;&quot;</span><span style="color: #339933;">;</span></li></ol></div></pre><!--END_DEVFMTCODE--><br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="HTML"><div class="devcodeoverflow"><ol><li><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;doSave&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;doSave&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Save&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/update-checkbox-value-using-php-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect No Host to WWW Host</title>
		<link>http://www.jamesnorthard.com/redirect-no-host/</link>
		<comments>http://www.jamesnorthard.com/redirect-no-host/#comments</comments>
		<pubDate>Fri, 23 Sep 2011 13:27:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Hack]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[HTTP_HOST]]></category>
		<category><![CDATA[No Host]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[REQUEST_URI]]></category>
		<category><![CDATA[WWW Host]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=158</guid>
		<description><![CDATA[Here is the code required to redirect no host to a www host. PHP and ASP versions of the code are included. PHP &#60;?phpif &#40;substr&#40;$_SERVER&#91;'HTTP_HOST'&#93;,0,3&#41; != 'www'&#41; &#123; header&#40;'HTTP/1.1 301 Moved Permanently'&#41;; header&#40;'Location: http://www.'.$_SERVER&#91;'HTTP_HOST'&#93; .$_SERVER&#91;'REQUEST_URI'&#93;&#41;;&#125;?&#62; ASP &#60;% if Request.ServerVariables&#40;&#34;HTTP_HOST&#34;&#41; = &#34;domain.com&#34; then Response.Redirect&#40;&#34;http://www.domain.com&#34;&#41; %&#62;]]></description>
			<content:encoded><![CDATA[<p>Here is the code required to redirect no host to a www host. PHP and ASP versions of the code are included.</p>
<p><strong>PHP</strong><br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="PHP"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">&lt;?php</span></li><li><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'www'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></li><li> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTP/1.1 301 Moved Permanently'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </li><li> <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: http://www.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span></li><li> <span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></li><li><span style="color: #009900;">&#125;</span></li><li><span style="color: #000000; font-weight: bold;">?&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--><br />
<strong>ASP</strong><br />
<!--DEVFMTCODE--><pre class="devcodeblock" title="ASP"><div class="devcodeoverflow"><ol><li><span style="color: #000000; font-weight: bold;">&lt;%</span> <span style="color: #990099; font-weight: bold;">if</span> <span style="color: #990099; font-weight: bold;">Request</span>.<span style="color: #330066;">ServerVariables</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;HTTP_HOST&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #cc0000;">&quot;domain.com&quot;</span> <span style="color: #990099; font-weight: bold;">then</span> <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Redirect</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;http://www.domain.com&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">%&gt;</span></li></ol></div></pre><!--END_DEVFMTCODE--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/redirect-no-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NAMIC Web Services</title>
		<link>http://www.jamesnorthard.com/namic-web-services/</link>
		<comments>http://www.jamesnorthard.com/namic-web-services/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 19:06:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured]]></category>

		<guid isPermaLink="false">http://www.jamesnorthard.com/?p=131</guid>
		<description><![CDATA[NAMIC Web Services (NWS), a division of NAMIC Service Corporation, is a professional web design company created to offer technology solutions to NAMIC Members and other industry organizations. NAMIC is the nation&#8217;s largest P/C insurance industry trade association, with more than 1,400 members.]]></description>
			<content:encoded><![CDATA[<p>NAMIC Web Services (NWS), a division of NAMIC Service Corporation, is a professional web design company created to offer technology solutions to NAMIC Members and other industry organizations. NAMIC is the nation&#8217;s largest P/C insurance industry trade association, with more than 1,400 members.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesnorthard.com/namic-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

