Skip to content
Advertisement

PHP unable to echo the text after a condition is met

I am not getting the desired result from the code below. Everything works fine But there is one main problem:

  1. When there is no song in the database it shows empty result just with back button. It fails to show echo ‘Sorry! This song is not available on our database.’;

I cant figure out where the mistake is. So plz help.

Thanks in advance!!!

JavaScript

Advertisement

Answer

First you have doubled “if if”:

JavaScript

Second, number of files can never be negative. You should compare if number is equal 0 (zero), not less than 0.

UPDATE:

Still wrong code:

JavaScript

This is not comparison, but assignment. You are giving $count value 0. For comparison you must use:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement