Results 1 to 4 of 4

Thread: array_splice? unset? which function is appropriate??

  1. #1
    Join Date
    Nov 2001
    Location
    Malaysia
    Posts
    23
    Rep Power
    0

    array_splice? unset? which function is appropriate??

    can anyone tell me wat is the appropriate function to use for this situation??

    i have all my ids stored in session and when user clicked add, then it will add into the cart. i display the user cart in a table with checkboxes beside each row of record. when user clicked the checkbox and delete, it should delete the record.

    i've tried using unset(), but it doesn't work for my case. none of the records are able to delete. then i switch to array_splice. by using this array, i manage to delete, but there is a problem, which is if user clicked the middle record, not the first one, but clicked the middle record, then it will delete the first record instead of the middle record.

    i really donot know which function is approriate for me to use. i really need help on this. pls advice me..

  2. #2
    Join Date
    Oct 2001
    Location
    Kuala Lumpur, Malaysia
    Posts
    296
    Rep Power
    229
    Sorry ... couldn't understand you. Rephrase please ... perhap with example.
    --------------------------------------------
    Khairil Iszuddin Ismail

  3. #3
    Join Date
    Aug 2002
    Posts
    14
    Rep Power
    0
    Are you saying you store an array in session? Can be more detail?
    Freedom is a Right

  4. #4
    Join Date
    Aug 2001
    Location
    Ampang KL
    Posts
    93
    Rep Power
    227
    If me, I'll use DB to store array info for a while. So my session can delete the array and re-add the array anytime.

    PHP Code:
    function var_to_object($obj)
    {
        
    //
        // transform any var to object
        // useful in cookie container
        //

        
    $z base64_encode(serialize($obj));
        return 
    $z;
    }

    function 
    object_to_var($var)
    {
        
    //
        // Re-transform back the object from var
        // to its original manner
        //

        
    $z unserialize(base64_decode($var));
        return 
    $z;


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. php ob_start function
    By Redzuan9999 in forum Website Programming
    Replies: 2
    Last Post: 04-12-2007, 10:38 AM
  2. wedding and function shooting
    By zzrmetal in forum Advertise Your Services
    Replies: 1
    Last Post: 03-09-2007, 01:26 AM
  3. Help needed in loadMovie() function!
    By eric in forum Website Design
    Replies: 9
    Last Post: 24-05-2004, 10:34 AM
  4. print function
    By ardella in forum Website Programming
    Replies: 2
    Last Post: 13-05-2004, 12:50 AM
  5. stripslashes() function for JSP?
    By lcf in forum Website Programming
    Replies: 3
    Last Post: 21-04-2004, 10:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112