Here is a direct quote from php.net:
http://www.php.net/manual/en/function.implode.php
This will get you started.
Hey, I found a good use for implode() today. It came from a need to have a
<select name=state multiple> box on the page that a person could
select multiple states from and send those to a >SELECT * FROM
customers WHERE state='$state'; query. But they need to be able to send
just one state also. Well, I changes the html select box to say <select
name=state[] multiple>. This turns $state into an array as you may
know. I then, later on in the script, did this:
$count = count( $state );
if( $count > 1 ) {
$states = implode( "'.'", $state );
$result = $database->query( "SELECT * FROM currentOrders
WHERE date>=$from AND date <=$to AND state IN ('$states')" );
}
//This takes care of multiple states, but if the user sent only one state,
I catch it here:
foreach( $state as $value );
if( $value )
$result = $database->query( "SELECT FROM currentOrders
WHERE date>=$from AND date<=$to AND state='$value'" );
else //This one will catch the ALL states option if they choose that.
$result = $database->query( "SELECT FROM currentOrders
WHERE date>=$from AND date<=$to" );