It’s the nature of experimental work that things will go wrong. How you react to this is one of the most important determinants of PhD success.
A natural response is to just try again. And again. And again. But, as Einstein said, “the definition of insanity is trying the same thing again and again and expecting a different result”.
Another natural response is to try something different, but if you keep changing your approach completely then you’ll always be starting again from zero.
The key, I think, is to slow down and break each step of the process down into its component parts, putting meticulous care and attention into each one. You can then test each step to find out exactly where it’s going wrong, instead of waiting until the end.
I know there’s pressure to get results, and to get them now, but focusing just on the results takes your attention away from the process (which is the one thing you can control).
That way, even if the experiment still doesn’t work, you know you’ve given it your best shot before trying the next option.