Ask a Question related to Dreamweaver AppDev, Design and Development.
-
duncan.lovett@litho.co.uk #1
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
-
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... -
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... -
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... -
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... -
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... -
Ken Robinson #2
Re: Excluding records from repeat region in PHP
duncan.lov...@litho.co.uk wrote (in part):Have you looked at the array function in PHP, especially> ******************
> 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.
> ******************
array_intersect() at [url]http://www.php.net/array_intersect[/url]
Ken
Ken Robinson Guest



Reply With Quote

