if condition in php and mysql [closed]

The problem is in this part of your code:

if($x=0)

That is an assignment and will always be 0.

You need to use a comparison operator such as ==or ===.

I.e.:

if($x==0)if($x===0)

Make sure you do have a value for the GET array.

Plus, do heed the warnings in comments.

You’re open to a SQL injection and working with a deprecated MySQL API which has been deleted in PHP 7.

Leave a Comment