Excluding records from repeat region in PHP

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Excluding records from repeat region in PHP

    PHP 4
    MySQL 4.0.20
    DW MW 2004 7.01

    This problem is giving me a bit of a headache, and I'm getting nowhere
    with it so thought I'd open it up to all, any help would be greatly
    appreciated.

    OVERVIEW
    --------
    I am creating an ecommerce site for an IT reseller. Customers must log
    in to use the purchasing side of the site.

    Individual customers that log in have certain products that they are
    not allowed to see but this varies between users, so no two customer
    may have the same hidden products.

    To set this scenario up, I have a main table containing the whole range
    of products the reseller sells, and a table referencing the hidden
    products, consisting of a "User ID" column and a "Product ID" column.

    In MySQL 4.1 I would have no problem running a subselect query and
    pulling just allowed products into a recordset, unfortunately I am
    running 4.0 which does not support this and I am not in a position to
    upgrade the server.

    I am currently getting around the problem by creating an 'Allowed
    products' table rather thatn 'hidden' and listing "User ID" and
    "Product ID" for all products they are allowed to view. This causes a
    bit of a problem as the reseller has about 6500 purchasing customers
    and 20000 products, so the 'allowed' table would grow incredibly huge,
    thats 130,000,000 records if all are allowed!

    GOAL
    ----
    The way I am planning to get around this problem is keep the 'Hidden'
    table, create TWO recordsets on a page - one, rsFetchProducts, a
    "SELECT * FROM Products" and the other, rsFetchHiddenProducts, "SELECT
    Product_ID from HiddenProducts where User_ID = 'users id number'".

    I then apply a repeat region to rsFetchProducts to list all data from
    the recordset.

    ******************
    What I need to do next is to filter this repeat region with PHP,
    basically saying - if any of the Product_ID(s) in rsFetchProducts is
    equal to any of the Product_ID(s) in rsFetchHiddenProducts, DON'T
    include them in the repeat region.
    ******************

    This must be possible, but by background on PHP isn't too great, I know
    I need an if condition in the repeat region, but am not sure if I need
    to filter directly from the recordset or pop it into an array first and
    then filter.

    If you would like to see my code etc, I can email it to you. I would
    appreciate some working code examples too due to lack of knowledge in
    PHP.

    Thanks guys
    Dunc

    duncan.lovett@litho.co.uk Guest

  2. Similar Questions and Discussions

    1. repeat region
      Hi.. I use repeat region to view only 10 records at a time, so how can I have another link that when user click on next it will go to another 10 of...
    2. problem with repeat region
      i'm currently doing an ecommerce website for my project. using dreamweaver and access for the database btw. so here's a brief description of how the...
    3. Repeat Region in Dreamweaver MX
      I do not know how this is done in MX. However, it would be very easy in raw php code. You have to declare a counter that counts the images displayed...
    4. php repeat region
      Hey guys, question about PHP, I'm trying to help out a friend but I don't really know anything about php. I'm also pretty amaturish at asp. I...
    5. Excluding Records
      I have people input records into a FM dbase and all the records(tab limited file) are then emailed to my home where I want to import them into my...
  3. #2

    Default Re: Excluding records from repeat region in PHP


    duncan.lov...@litho.co.uk wrote (in part):
    > ******************
    > What I need to do next is to filter this repeat region with PHP,
    > basically saying - if any of the Product_ID(s) in rsFetchProducts is
    > equal to any of the Product_ID(s) in rsFetchHiddenProducts, DON'T
    > include them in the repeat region.
    > ******************
    Have you looked at the array function in PHP, especially
    array_intersect() at [url]http://www.php.net/array_intersect[/url]

    Ken

    Ken Robinson Guest

Posting Permissions

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

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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139