This topic is locked
[SOLVED]

 Display records that belong to the user

2/15/2017 3:27:05 AM
PHPRunner General questions
P
phpcmk author

Hi,
In phpRunner, I am trying to show only records that belong to the user based on the dept column when the user login.
I have user_login table with following columns:

eg.

staff_id = A1

dept = deptA,deptB,deptC
I have record table with the following columns:

eg.

record_id = 100

dept = deptA,deptB
In "After Successful login", i have the following code which capture user's dept.



$_SESSION["dept"]=$data['dept'];


In "After table initialized", I used the following code.



$login=explode(",",$_SESSION["dept"]);

$query->addWhere("dept like '". %$login[1]% ."'");


And I received the following error:



Parse error: syntax error, unexpected '%'


Can someone kindly help how to display the record if the record dept did contain $login[1]?
Thanks.

P
pamgeo 2/15/2017

hey , change this $query->addWhere("dept like '". %$login[1]% ."'"); to the following
$query->addWhere("dept like '%". $login[1] ."%'");
and retry.



Hi,
In phpRunner, I am trying to show only records that belong to the user based on the dept column when the user login.
I have user_login table with following columns:

eg.

staff_id = A1

dept = deptA,deptB,deptC
I have record table with the following columns:

eg.

record_id = 100

dept = deptA,deptB
In "After Successful login", i have the following code which capture user's dept.



$_SESSION["dept"]=$data['dept'];


In "After table initialized", I used the following code.



$login=explode(",",$_SESSION["dept"]);

$query->addWhere("dept like '". %$login[1]% ."'");


And I received the following error:
Can someone kindly help how to display the record if the record dept did contain $login[1]?
Thanks.

A
azmi 2/16/2017



hey , change this $query->addWhere("dept like '". %$login[1]% ."'"); to the following
$query->addWhere("dept like '%". $login[1] ."%'");
and retry.