Hi
I have 2 problems at the moment
Firstly I have a database controlling wine storage where I would like the clients to log into the database and see the following
1) No of pallets sorted by the winetype and vintage
2) no of pallets sorted by the destination
3) No of pallets sorted by the category (type of Storage 'L/D' lying down bottles, 'S/U' standing up bottles '3H' 3 Pallets high )
I created in _globals.php the following
function login_ok($memberInfo, &$args) {
$logFile = 'members.log';
$usrindex = $memberInfo['custom'][0]; */= (custindex) */
$usrname = $memberInfo['custom'][1]; */= (custname) */
$ip = $memberInfo['IP'];
$date = date('m/d/Y');
$time = date('h:i:s a');
file_put_contents($logFile, "$date, $time,$usrindex,$usrname \n", FILE_APPEND);
return ' ' ;
}
so how do I get in the SQL "WHERE custindex = '$usrindex' "?
With the login the client show only get to see his pallets/
thanks for your help
David
Having a Problem getting a Global Variable
Re: Having a Problem getting a Global Variable
Hi,
you reference 2 problems. But I'm not even clear on one of them. Can you specify this in more details?
From what you write I would assume that you store in$memberInfo['custom'][0]; a custindex that you have in your product table as well.
If you try to display only the product for the user which match his custindex you can use the _init hook (hooks -> TABLENAME.php -> TABLENAME_init)
Here you can use some code like:
assuming your field is named custindex
you reference 2 problems. But I'm not even clear on one of them. Can you specify this in more details?
From what you write I would assume that you store in$memberInfo['custom'][0]; a custindex that you have in your product table as well.
If you try to display only the product for the user which match his custindex you can use the _init hook (hooks -> TABLENAME.php -> TABLENAME_init)
Here you can use some code like:
Code: Select all
$usrindex = $memberInfo['custom'][0];
$options->QueryWhere = $options->QueryWhere ? $options->QueryWhere . " AND " : " WHERE ";
$options->QueryWhere .= "custindex = {$userindex}";
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Having a Problem getting a Global Variable
HI
thanks a lot for your help and you are right.
I also solved the problem using the filter as follows
regards
David
thanks a lot for your help and you are right.
I also solved the problem using the filter as follows
Code: Select all
function products_init(&$options, $memberInfo, &$args) {
$idx = $memberInfo['custom'][0];
$idx1 = $memberInfo['custom'][1];
if(!$_POST['FilterField'][1] && !$_GET['FilterField'][1]){
addFilter(1, 'and', 6, 'equal-to', $memberInfo['custom'][0]);
}
David