<?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>Antonio Ciccarone &#187; php</title>
	<atom:link href="http://blog.antoniociccarone.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.antoniociccarone.com</link>
	<description>Life, Code and Music</description>
	<lastBuildDate>Tue, 25 Oct 2011 21:39:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Connect to MySQL Function</title>
		<link>http://blog.antoniociccarone.com/connect-to-mysql-function/</link>
		<comments>http://blog.antoniociccarone.com/connect-to-mysql-function/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 21:27:21 +0000</pubDate>
		<dc:creator>Antonio Ciccarone</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.antoniociccarone.com/?p=158</guid>
		<description><![CDATA[Connect to a MySQL database.  Download the zip with all related php files. <a href="http://blog.antoniociccarone.com/connect-to-mysql-function/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is how I connect to a MySQL database.  The following code is based off of three or four separate php files but could <strong>insecurely</strong> be combined into one.  We&#8217;ll be creating functions.php which holds all of the code that the site uses, settings.php which holds the configurable options and a connection.php that connects to the database.  The fourth and obviously optional file is your index.php (or wherever you&#8217;re connecting from)</p>
<p>First, in functions.php we&#8217;ll define our connectSQL.  It takes four arguments and connects or returns an error if unsuccessful</p>
<div id="code">

<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?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p158code1'); return false;">View Code</a> LANGUAGE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1581"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p158code1"><pre class="language" style="font-family:monospace;">function connectSQL($server, $user, $pass, $name) {
	define(&quot;DB_SERVER&quot;, $server);define(&quot;DB_USER&quot;, $user);define(&quot;DB_PASS&quot;, $pass);define(&quot;DB_NAME&quot;, $name);
	$connection = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
	if (!$connection) {
		die(&quot;Database connection failed: &quot; . mysql_error());
	}
	$db_select = mysql_select_db(DB_NAME,$connection);
	if (!$db_select) {
		die(&quot;Database selection failed: &quot; . mysql_error());
	}
}</pre></td></tr></table></div>

</div>
<p>In settings.php we&#8217;ll assign values to the variables.  Always remember to use secure passwords.</p>
<div id="code">

<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?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p158code2'); return false;">View Code</a> LANGUAGE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1582"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p158code2"><pre class="language" style="font-family:monospace;">// Database Configuration
$database['server'] = &quot;localhost&quot;;
$database['user'] = &quot;xxx&quot;;
$database['password'] = &quot;xxx&quot;;
$database['name'] = &quot;xxx&quot;;</pre></td></tr></table></div>

</div>
<p>The actual connection code is now pretty easy to implement.  You can call it whenever and however you&#8217;d like with only one line of code.</p>
<div id="code">

<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?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p158code3'); return false;">View Code</a> LANGUAGE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1583"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p158code3"><pre class="language" style="font-family:monospace;">// Connection to the database via function
connectSQL($database['server'], $database['user'], $database['password'], $database['name']);</pre></td></tr></table></div>

</div>
<p>Finally, to actually use this, simply include the connection.php</p>
<div id="code">

<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?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p158code4'); return false;">View Code</a> LANGUAGE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1584"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p158code4"><pre class="language" style="font-family:monospace;">include 'connection.php';</pre></td></tr></table></div>

</div>
<p><a href="downloads/Connect to MySQL Function.zip"><img src="images/downloadCode.png" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.antoniociccarone.com/connect-to-mysql-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Make a Monster.</title>
		<link>http://blog.antoniociccarone.com/how-to-make-a-monster/</link>
		<comments>http://blog.antoniociccarone.com/how-to-make-a-monster/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 14:28:28 +0000</pubDate>
		<dc:creator>Antonio Ciccarone</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[game changer]]></category>
		<category><![CDATA[nar]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[realtor]]></category>

		<guid isPermaLink="false">http://blog.antoniociccarone.com/how-to-make-a-monster/</guid>
		<description><![CDATA[I love that song. After a day of focus groups and meetings yesterday, it&#8217;s going to be nice to get back to my code and script. I&#8217;m all Realtor&#8217;d out and need some quiet time with Notepad++. I&#8217;m really looking &#8230; <a href="http://blog.antoniociccarone.com/how-to-make-a-monster/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love that song.  After a day of focus groups and meetings yesterday, it&#8217;s going to be nice to get back to my code and script.  I&#8217;m all Realtor&#8217;d out and need some quiet time with Notepad++.  I&#8217;m really looking forward to see where NAR and my company will take the Game Changer idea, it seemed to devolve and evolve yesterday with the responses of the Brokers, Agents and Assistants.  </p>
<p>I&#8217;ve gotten most of the install portion working and learned a lot through the process, like making dynamic configuration files on the fly and code cleanliness and reusablility.  Fun, fun.  </p>
<p>Thought of a great website idea (non-real estate) yesterday, I might mock it up on paper today.  Happy Hump Day! </p>
<p><a class="a2a_button_facebook" href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_google_bookmarks" href="http://www.addtoany.com/add_to/google_bookmarks?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="Google Bookmarks" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/google.png" width="16" height="16" alt="Google Bookmarks"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><a class="a2a_button_stumbleupon" href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a><a class="a2a_button_ping" href="http://www.addtoany.com/add_to/ping?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="Ping" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/ping.png" width="16" height="16" alt="Ping"/></a><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="Digg" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_linkedin" href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;linkname=How%20to%20Make%20a%20Monster." title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.antoniociccarone.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.antoniociccarone.com%2Fhow-to-make-a-monster%2F&amp;title=How%20to%20Make%20a%20Monster." id="wpa2a_2">Share Me</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.antoniociccarone.com/how-to-make-a-monster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting my feet RET</title>
		<link>http://blog.antoniociccarone.com/getting-my-feet-ret/</link>
		<comments>http://blog.antoniociccarone.com/getting-my-feet-ret/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 19:31:26 +0000</pubDate>
		<dc:creator>Antonio Ciccarone</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[real estate]]></category>
		<category><![CDATA[rets]]></category>

		<guid isPermaLink="false">http://blog.antoniociccarone.com/?p=19</guid>
		<description><![CDATA[Today I'll be connecting to a Postgres database for the first time.   I'm used to mySQL but I hear they're basically the same when it comes down to functionality. <a href="http://blog.antoniociccarone.com/getting-my-feet-ret/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ll be connecting to a Postgres database for the first time.   I&#8217;m used to mySQL but I hear they&#8217;re basically the same when it comes down to functionality.   I&#8217;ve already started working on <a title="Ajax-Based Property Search" href="http://dev.urbiance.com/ajax/" target="_blank">an AJAX based property search</a> with some sample data, so I just have to take my code off of dev.urbiance and hook it into our server.</p>
<p>I&#8217;m also a virgin to remote databases, it looks like the connection is working &#8211; but I haven&#8217;t queried or echoed anything yet.  So far I&#8217;ve got a Javascript price slider, city selector and zip code input which send an XMLHttp request to a php page, query the property table and send the response text back into a div.  Going for a completely object-oriented code structure here, wish me luck.  I&#8217;ll be updating my progress and snippets along the way here on my blog.</p>
<p>
<span class="signature">Happy remote coding, Antonio</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.antoniociccarone.com/getting-my-feet-ret/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

