<?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: Checkboxes/Multiple Select Boxes in PHP</title>
	<atom:link href="http://www.snipe.net/2006/06/checkboxesmultiple-select-boxes-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.snipe.net/2006/06/checkboxesmultiple-select-boxes-in-php/</link>
	<description>Bitterness never tasted so sweet</description>
	<lastBuildDate>Tue, 24 Jan 2012 02:52:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: YuriKolovsky</title>
		<link>http://www.snipe.net/2006/06/checkboxesmultiple-select-boxes-in-php/comment-page-1/#comment-10349</link>
		<dc:creator>YuriKolovsky</dc:creator>
		<pubDate>Thu, 21 Apr 2011 18:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.snipe.net/?p=26#comment-10349</guid>
		<description>What if I want to populate the multiple select listboxes from a MySQL database?</description>
		<content:encoded><![CDATA[<p>What if I want to populate the multiple select listboxes from a MySQL database?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: snipe</title>
		<link>http://www.snipe.net/2006/06/checkboxesmultiple-select-boxes-in-php/comment-page-1/#comment-8973</link>
		<dc:creator>snipe</dc:creator>
		<pubDate>Sun, 22 Aug 2010 20:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.snipe.net/?p=26#comment-8973</guid>
		<description>You would dynamically construct the query.

$sql = &quot;select * from table &quot;;

// there is at least one checkbox selected
if (count($foo) &gt; 0) {

$sql .=&#039; where &#039;;

for ($i=0;$i&lt;count($foo);$i++) {

$sql .=&quot; checkbox = &#039;&quot;.$foo[$i].&quot;&#039; AND &quot;; 

} // end &quot;for&quot; loop
}

You&#039;d need to throw a counter in there too, to determine whether or not you&#039;ve hit the last checked box value, and suppress the AND statement - or you&#039;d make the last part of the sql statement something that you know will always be true.</description>
		<content:encoded><![CDATA[<p>You would dynamically construct the query.</p>
<p>$sql = &#8220;select * from table &#8220;;</p>
<p>// there is at least one checkbox selected<br />
if (count($foo) > 0) {</p>
<p>$sql .=&#8217; where &#8216;;</p>
<p>for ($i=0;$i<count($foo);$i++) {</p>
<p>$sql .=&#8221; checkbox = &#8216;&#8221;.$foo[$i].&#8221;&#8216; AND &#8220;; </p>
<p>} // end &#8220;for&#8221; loop<br />
}</p>
<p>You&#8217;d need to throw a counter in there too, to determine whether or not you&#8217;ve hit the last checked box value, and suppress the AND statement &#8211; or you&#8217;d make the last part of the sql statement something that you know will always be true.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dana</title>
		<link>http://www.snipe.net/2006/06/checkboxesmultiple-select-boxes-in-php/comment-page-1/#comment-8971</link>
		<dc:creator>dana</dc:creator>
		<pubDate>Fri, 20 Aug 2010 20:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.snipe.net/?p=26#comment-8971</guid>
		<description>Just wondering if you could give an example of how you would use the selected check boxes in a mysql query using a select statement... such as select * from mytable where check1=&#039;value1&#039; AND check2=&#039;value2&#039; AND....; my point is what if one of the check marks is left blank then your query wouldn&#039;t return what you want because it would be searching for a AND check1=&#039; &#039;...</description>
		<content:encoded><![CDATA[<p>Just wondering if you could give an example of how you would use the selected check boxes in a mysql query using a select statement&#8230; such as select * from mytable where check1=&#8217;value1&#8242; AND check2=&#8217;value2&#8242; AND&#8230;.; my point is what if one of the check marks is left blank then your query wouldn&#8217;t return what you want because it would be searching for a AND check1=&#8217; &#8216;&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.395 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-01-25 09:50:57 -->

