Trust in Allah saves one from idolizing the means. Allah has created all the resources for man to utilize them in a manner similar to Allah. Allah thus carries out all His works through the creation of means although we may not perceive them at all times. For example, Allah has created a cure for every illness, therefore seeking such a cure is in accordance with the Divine scheme. It is, however, wrong to believe that only the medicine or the doctor is responsible for nurturing us back to health.
Prayer is also a part of the means at one's disposal.
It is therefore imperative to make a full and concerted effort, supplicate before Allah, and accept the outcome as it may be.