Remove the last character from a string
Posted: Wed Jul 05, 2006 4:32 pm
I am trying to unravel a string and place it into an Insert Query like so:
The problem is that because a I have to have a comma to seperate each entry into my Insert query, I have an extra comma at the end (ie ( '$value', ) which won't execute properly. Unfortunately, additional looping structure is not an option. Is there anyway to trip this last comma off the string? Thanks.
Code: Select all
foreach($array as $value)
{
$insert .= " '$value', ";
}