Edit:The problem's been solved.I used PDO's prepared statement to use where by using ? in place of the variable and then later binding it with the variable string.
I have used the below mentioned sql query to join two tables and display there data.Here it is
SELECT docinfo.fnamedoc,docinfo.lnamedoc,docinfo.department,
prescriptions.prescription FROM docinfo INNER JOIN prescriptions
ON docinfo.unamedoc=prescriptions.unamed
When i use an additional WHERE alongside this statement than i am it works with an SQL DB software "DB browser for SQLite" when i run the sql code on it but it isnt working with php.Nothing gets displayed when i use where but the code in php works when i dont use where.
The code with WHERE is as follows:
SELECT docinfo.fnamedoc,docinfo.lnamedoc,docinfo.department,
prescriptions.prescription FROM docinfo INNER JOIN prescriptions
ON docinfo.unamedoc=prescriptions.unamed WHERE prescriptions.unamep=$uname`
The picture of query running successfully in "DB browser for sqlite" and displaying one row is as follows SQL Query in DB Browser for SQLITE