Most efficient code plz
Could someone plz help me to figure out the simplest "if" or "If/else" or whatever would be the most simplest way to code this https://code.sololearn.com/wiRIgGIn3P8l/#php what im trying to to is execute the first statement, but if the first statement returns no valid result echo "no posts in DB" (or something similar) but if it does then continue to the second statement and basically the same thing, if no result is returned just echo a message. Do i first have to do q query to see if each statement will fetch a valid result, or is the a way to write it as im trying to accomplish , as if first statement gives valid return, continue to next if next statement has no valid return then stop after first statement? I hope I am making this understandable, sorry if it is hard to follow. Thank you anyone that is taking time to look at what im asking. (edit: I was just thinking would a switch statement be appropriate? if so could someone provide a bit of guidance on how to write it.?)