First of all: never ever use a Post variable directly in a database query. If you use this code in your office, I can delete your whole database by entering a search text. Please use prepared statements.
Second: never ever use Select *. Imagine you will extend the table some times and add some columns containing images. Then you will always load a huge amount of data which is never used.
Always precise which columns you need in the query.
Your query can be done by JOIN
SELECT pa.code, fname, mname, lname, sname, ddata, adata, pdisagnose
FROM table 1 pa
LEFT JOIN table 2 di on di.code = pa.code
Third: your LIKE statement will not work this way. I don’t know in which of the name columns you expect to find the search term. Maybe in all?