So I am trying to build an INSERT statement for SQL. I have an associative array with values in it. And on the last value I want to put a ")".
Here is my code
$cols;
foreach($columns as $key => $item)
{
if($item == end($columns))
{
$cols .= $key.") ";
}//end if
else
{
$cols .= $key.", ";
}//end else
}//end foreach
So my problem is that the "if" always comes out as true. How do I make it NOT come out as true?