Coding for two if statement with on digitalread

Well, firstly, sensors by definition read, not write....

But second and maybe more important, did you try my suggestion in your other, almost identical post, which was to:

have a look at the Tutorial Page and get the basics of programming under your belt. Also have a look at whatever documentation is available for the sensor you bought, and figure out how to hook it up, and read its values.

And lastly, you're likely to get moderated for this second thread. Re-posting won't help you get more info, it just pisses people off. If you tried what was suggested to you by me and by PeterH, respond in the other thread. If you don't like our suggestion, well, that is of course your choice....

In the first thread, at least help us to help you by giving details of the sensor, a schematic of the circuit, and post your code so far. Tell us what did and didn't happen, and what should have happened.