Reputation: 35
I cannot spot the difference of these queries.
$lastact="SELECT * FROM DOC_DETAILS WHERE 1=1 AND DOC_TYPE=$emp_id";
$whr="";
1. ...
$docfk=$emprow['ICID'];
$whr .= " AND DOC_TYPE=$docfk";
$qry1=mysqli_query($conn,$lastact .$whr);
...
2. ...
$qry1=mysqli_query($conn,"SELECT * FROM DOC_DETAILS WHERE 1=1 AND DOC_FK=$docfk");
...
the 1st query doesn't return any result while the 2nd works fine.
Thanks very much for any help.
Upvotes: 1
Views: 70
Reputation: 113
In the first query you add "DOC_TYPE=$emp_id" but in second query "DOC_TYPE=$emp_id" this condition not found so first need to check this condition add/remove if not getting result then tell me again
Upvotes: 0
Reputation: 111219
The SQL in the first query will be
SELECT * FROM DOC_DETAILS WHERE 1=1 AND DOC_TYPE=$emp_id AND DOC_TYPE=$docfk
If emp_id and docfk are different this will return no results.
Upvotes: 1