Hi,

Sorry for not being clear. I think the substr(); will work for me 
too. However, with that said I'd like to better explain what I'm 
trying to do. Maybe you are someone has a better technique.

I'm allowing a user to make multiple selections by using a check box 
on a form. The selections are stored in an array. The user may visit 
ant number of pages to make these selection. I want to do a duplicate 
selection check in case they select the same thing twice. If they 
make the same selection twice, I want to remove the duplicate from 
the array and show them which item was duplicated. Then when they 
commit there selection I need to create an SQL query from the array 
using a foreach() loop to generate the INSERT statement. I also need 
to use the same technique for deleting items from a table. That is 
where I was using the 'OR'.

Sincerely,
Mike
--
Mike Brandonisio                 *    IT Planning & Support
Tech One Illustration            *    Database Applications
tel (630) 759-9283               *    e-Commerce
[EMAIL PROTECTED]  *    www.techoneillustration.com


On Jun 5, 2006, at 4:56 AM, [EMAIL PROTECTED] wrote:

> On 5 Jun 2006, at 09:44, Mike Brandonisio wrote:
>
>> Hi,
>>
>> Is there a php function that will recreate the numeric array keys 0
>> to what ever is in the array or should I just render a new temp array
>> with a while or foreach loop? I'm trying to do some array
>> manipulation and not having the array keys in sequence does not work.
>> Partly I'm trying to create an SQL query with ID='value' OR with a
>> loop but cannot have an OR after the last entry, so I'm ctrying to
>> count() the array and use the condition of 'count() - $key > 1' to
>> insert the OR so that when the last on is reach it does not because
>> it is = to 1. When the array not in sequence the that last key and
>> count value will not work together properly.
>
> Your post is a little difficult to follow, but I think I get it.
>
> There are array sorting functions available in php
> http://jp.php.net/manual/en/function.asort.php
> asort & arsort may be useful to you.
>
> As for the SQL query - dont worry about the extra OR at the end -
> just strip it out.
> Build your query string in a variable, expecting to have an extra OR
> on the end...
> $sql="SELECT * FROM table WHERE Field1='abc' OR Field2='abc' OR";
> Then strip off the last few chars using substr();
> http://jp.php.net/manual/en/function.substr.php
>
> Hope it helps
> Riquez
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
> ~-->
> Everything you need is one click away.  Make Yahoo! your home page 
> now.
> http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/HKFolB/TM
> --------------------------------------------------------------------
> ~->
>
> Community email addresses:
>   Post message: [email protected]
>   Subscribe:    [EMAIL PROTECTED]
>   Unsubscribe:  [EMAIL PROTECTED]
>   List owner:   [EMAIL PROTECTED]
>
> Shortcut URL to this page:
>   http://groups.yahoo.com/group/php-list
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list




SPONSORED LINKS
Php mysql Job postings


YAHOO! GROUPS LINKS




Reply via email to