You are here: Re: live records « PHP « IT news, forums, messages
Re: live records

Posted by Jasper Bryant-Greene on 03/27/05 09:11

Ryan A wrote:
> Hey all,
> [snip]
> I am reading off an array from the users cookie called "user_cookie"
> the array is a bunch of numbers like this:
> [snip]
> the numbers are the cart items the user has saved and they match a
> "item_number" field in my mysql db, the arrays name is $cart_arr
>
> what i am doing is running a select * from my_db where item_number=x and
> item_number=x etc based on the items stored in the array, this info will be
> displayed in a neat little table when he clicks on "show items in my cart"
> or something as such...so far so good, heres my problem:
>
> sometimes items get deleted or are taken off the "active" list, when this
> happens I would like to take out these times from $cart_arr....how do i do
> that?
> Thanks in advance,
> Ryan

Hi Ryan

if $item_number is your item number to delete:

if(($array_key = array_search($item_number, $cart_arr) !== false) {
unset($cart_arr[$array_key]);
}

Best regards
--
Jasper Bryant-Greene
Cabbage Promotions
www: www.cabbage.co.nz
email: jasper@cabbage.co.nz
phone: 021 232 3303

Public Key: Jasper Bryant-Greene <jasper@cabbage.co.nz> keyID 0E6CDFC5
Fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация