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, rsFetchHiddenPr oducts, "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 rsFetchHiddenPr oducts, 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
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, rsFetchHiddenPr oducts, "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 rsFetchHiddenPr oducts, 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
Comment