<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Snippet: Creating &amp; Debugging Complex SQL queries in Symfony</title>
	<atom:link href="http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony/feed" rel="self" type="application/rss+xml" />
	<link>http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony</link>
	<description>Web development, Symfony, Wordpress and general geekery</description>
	<lastBuildDate>Mon, 23 Jan 2012 20:31:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: ErisDS</title>
		<link>http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony/comment-page-1#comment-833</link>
		<dc:creator>ErisDS</dc:creator>
		<pubDate>Thu, 26 Aug 2010 15:20:03 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=1039#comment-833</guid>
		<description>Well that still doesn&#039;t have a comma between your SELECT items, and the quotes are all different - look at the ones around &quot;select&quot; and then look at the other ones... they are not the same.</description>
		<content:encoded><![CDATA[<p>Well that still doesn&#8217;t have a comma between your SELECT items, and the quotes are all different &#8211; look at the ones around &#8220;select&#8221; and then look at the other ones&#8230; they are not the same.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benbrahim</title>
		<link>http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony/comment-page-1#comment-832</link>
		<dc:creator>benbrahim</dc:creator>
		<pubDate>Thu, 26 Aug 2010 15:15:38 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=1039#comment-832</guid>
		<description>thanks you, i fund the mistak i&#039;m added \&quot; in like condition 
$sql = ‘select ‘. self::NAME .” “. self::LASTNAME.” from ” .self::TABLE_NAME .” where “.self::NAME .” like \&quot;%a%\&quot;  ” ;</description>
		<content:encoded><![CDATA[<p>thanks you, i fund the mistak i&#8217;m added \&#8221; in like condition<br />
$sql = ‘select ‘. self::NAME .” “. self::LASTNAME.” from ” .self::TABLE_NAME .” where “.self::NAME .” like \&#8221;%a%\&#8221;  ” ;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ErisDS</title>
		<link>http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony/comment-page-1#comment-827</link>
		<dc:creator>ErisDS</dc:creator>
		<pubDate>Thu, 26 Aug 2010 12:42:57 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=1039#comment-827</guid>
		<description>Try copying my code snippet from my earlier comment where I have matched all the quotes properly - yours are all mixed up. Also you are missing the comma between your select fields.

Try [cc lang=&quot;php&quot;]print_r($sql);[/cc] as well - that should help show you where the mistakes are.</description>
		<content:encoded><![CDATA[<p>Try copying my code snippet from my earlier comment where I have matched all the quotes properly &#8211; yours are all mixed up. Also you are missing the comma between your select fields.</p>
<p>Try</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/print_r"><span style="color: #990000;">print_r</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>as well &#8211; that should help show you where the mistakes are.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: benbrahim</title>
		<link>http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony/comment-page-1#comment-823</link>
		<dc:creator>benbrahim</dc:creator>
		<pubDate>Wed, 25 Aug 2010 11:58:35 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=1039#comment-823</guid>
		<description>i&#039;am using propel but i wish using this type of query  $sql = ‘select ‘. self::NAME .” “. self::LASTNAME.” from ” .self::TABLE_NAME .” where “.self::NAME .” like .‘%a%’ ” ;</description>
		<content:encoded><![CDATA[<p>i&#8217;am using propel but i wish using this type of query  $sql = ‘select ‘. self::NAME .” “. self::LASTNAME.” from ” .self::TABLE_NAME .” where “.self::NAME .” like .‘%a%’ ” ;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ErisDS</title>
		<link>http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony/comment-page-1#comment-821</link>
		<dc:creator>ErisDS</dc:creator>
		<pubDate>Tue, 24 Aug 2010 15:01:36 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=1039#comment-821</guid>
		<description>At first glance, the only problem I can see is that your quotes are all mixed up.

You need to pay special attention to these, use spacing properly to make it easier to read and you will spot those mistakes more easily:

[cc lang=&quot;php&quot;]$sql = &#039;SELECT &#039; .  self::NAME  .  &#039;, &#039;  .  self::LASTNAME . &#039; FROM &#039; . self::TABLE_NAME . &#039; WHERE &#039; . self::NAME . &#039; LIKE &quot;%a%&quot;&#039; ;[/cc]

Not sure if you&#039;re using doctrine or propel as you didn&#039;t say, but with Propel Criteria there is no reason why you would need to use SQL to create this query. Instead use:

[cc lang=&quot;php&quot;]$criteria-&gt;add(self::NAME, &quot;%a%&quot;, Criteria::LIKE);[/cc]</description>
		<content:encoded><![CDATA[<p>At first glance, the only problem I can see is that your quotes are all mixed up.</p>
<p>You need to pay special attention to these, use spacing properly to make it easier to read and you will spot those mistakes more easily:</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT '</span> <span style="color: #339933;">.</span> &nbsp;<span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">NAME</span> &nbsp;<span style="color: #339933;">.</span> &nbsp;<span style="color: #0000ff;">', '</span> &nbsp;<span style="color: #339933;">.</span> &nbsp;<span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">LASTNAME</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' FROM '</span> <span style="color: #339933;">.</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">TABLE_NAME</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' WHERE '</span> <span style="color: #339933;">.</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">NAME</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' LIKE &quot;%a%&quot;'</span> <span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Not sure if you&#8217;re using doctrine or propel as you didn&#8217;t say, but with Propel Criteria there is no reason why you would need to use SQL to create this query. Instead use:</p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$criteria</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">NAME</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;%a%&quot;</span><span style="color: #339933;">,</span> Criteria<span style="color: #339933;">::</span><span style="color: #004000;">LIKE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: benbrahim</title>
		<link>http://erisds.co.uk/symfony/snippet-creating-debugging-complex-sql-queries-in-symfony/comment-page-1#comment-820</link>
		<dc:creator>benbrahim</dc:creator>
		<pubDate>Tue, 24 Aug 2010 14:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://erisds.co.uk/?p=1039#comment-820</guid>
		<description>thanks for your post, i wish to add a like, to produce this sql like this  : select branch.ROOT_ID, branch.NAME FROM `branch` WHERE branch.NAME  like &#039;%all%&#039; ; 
any idea ?!!! 
this is my code
$sql = &#039;select &#039;. self::NAME .&quot; &quot;. self::LASTNAME.&quot;  from &quot; .self::TABLE_NAME .&quot; where &quot;.self::NAME .&quot; like &#039;%a%&#039; &quot; ; 
but i have error in  &#039;%a%&#039; do you now why !!!!
thanks</description>
		<content:encoded><![CDATA[<p>thanks for your post, i wish to add a like, to produce this sql like this  : select branch.ROOT_ID, branch.NAME FROM `branch` WHERE branch.NAME  like &#8216;%all%&#8217; ;<br />
any idea ?!!!<br />
this is my code<br />
$sql = &#8216;select &#8216;. self::NAME .&#8221; &#8220;. self::LASTNAME.&#8221;  from &#8221; .self::TABLE_NAME .&#8221; where &#8220;.self::NAME .&#8221; like &#8216;%a%&#8217; &#8221; ;<br />
but i have error in  &#8216;%a%&#8217; do you now why !!!!<br />
thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

