<?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>Website Design Ireland, Website Development &#187; debugging SQL</title>
	<atom:link href="http://www.eire-webdesign.ie/blog/tag/debugging-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eire-webdesign.ie/blog</link>
	<description>Web Design and Development</description>
	<lastBuildDate>Sat, 02 Jan 2010 14:53:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Debugging Live Website</title>
		<link>http://www.eire-webdesign.ie/blog/2008/04/03/debugging-live-website/</link>
		<comments>http://www.eire-webdesign.ie/blog/2008/04/03/debugging-live-website/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 18:15:23 +0000</pubDate>
		<dc:creator>Louie @ Eire Web Design</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[debugging SQL]]></category>

		<guid isPermaLink="false">http://www.eire-webdesign.ie/blog/2008/04/03/debugging-live-website/</guid>
		<description><![CDATA[Debugging a live website it&#8217;s a pain in the neck, especially if you are working on changing database queries. You can&#8217;t &#8220;echo&#8221; the SQL query to find out how is formatted and why the result are not the right ones, but you CAN &#8220;Email&#8221; it to yourself and check it out when it arrives in [...]]]></description>
			<content:encoded><![CDATA[<p>Debugging a live website it&#8217;s a pain in the neck, especially if you are working on changing database queries.<br />
You can&#8217;t &#8220;echo&#8221; the SQL query to find out how is formatted and why the result are not the right ones, but you CAN &#8220;Email&#8221; it to yourself and check it out when it arrives in your inbox.</p>
<p>This is exactly what the php function below will do:<br />
( just change the <a href="mailto:myemail@server.com">myemail@server.com</a> to your email address )</p>
<pre lang="php">
function ewd_email_sql($sSql){  $my_email = "myemail@server.com";//set your email address

  $my_subject = "SQL Query Email";//email subject

  $my_message = !empty($sSql) ? $sSql : "SQL Query was empty";

  $my_ip = ""; //enter your IP ADDRESS to make sure you only send the email when you view this page

$mime_boundary = "&lt;&lt;&lt;--==+X[".md5(time())."]\r\n\r\n";// Generate a boundary string

  $headers = "From:".$my_email."\r\n".

                "To:".$my_email."\r\n".

                 "MIME-Version: 1.0\r\n" .

                 "Content-Type: text/plain;\r\n".

                 "boundary=\"".$mime_boundary."\"\r\n";

  if(!empty($my_ip) &amp;&amp; $_SERVER['REMOTE_ADDRESS'] == $my_ip){

    mail($my_email,$my_subject,$my_message,$headers);

  }

  return;

}

//usage e.g

$sSql = "SELECT * FROM table_name WHERE something='".addslashes("something_else")."'";

  //email it

  ewd_email_sql($sSql);//call function

..............

//rest of the code below</pre>
<p>Hope it helps&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eire-webdesign.ie/blog/2008/04/03/debugging-live-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
