This is the code I have:
$sql = mysql_query("SELECT * FROM dt_directories WHERE category = '$category' ORDER BY name") or die(mysql_error());
$last_sql = mysql_query("SELECT * FROM dt_directories WHERE category = '$category' ORDER BY name DESC LIMIT 1") or die(mysql_error());
while ( $last = mysql_fetch_object($last_sql) ) {
$last_element = "$last->name";
}
while ( $dirs = mysql_fetch_array($sql) ) {
$allowed_dirs = $allowed_dirs."name = '$dirs[name]' OR ";
}
What this does is output the following into the variable $allowed_dirs:
E.G - name = 'Best of the Web' OR name = 'Dmoz' OR name = 'Yahoo!' OR
Another part of the code outputs the last element in the array to the variable $last_element, in the example above, $last_element would be "Yahoo!"
What I want to do is use $last_element to remove the last "OR" in the example above. Any ideas?