Re: live records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx
phone:	021 232 3303

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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux