Hi,

Sunday, November 2, 2003, 3:25:09 AM, you wrote:
RK> I feel really stupid posting this but I can't seem to find the correct
RK> syntax in the language guide. I have a string which has been progressively
RK> built during a FOREACH loop through an array (a SELECT statement in which
RK> the WHERE part is built with ORs from the array of entries). The final
RK> query winds up with an extra "OR" at the end. I need to simply delete
RK> characters (STRLEN($string) - 3) through STRLEN($string). What's the proper
RK> syntax?

change your logic and put the OR first like this

$string = '';

for($x=0;$x<4;$x++){
  if(!empty($string)) $string .= ' OR ';
  $string .= 'word';
}

This way OR only gets added if there is already something in the string
-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to