[Solved] How to compare two variables in php


I want to compare coming get variable with nursery

But then you are comparing with Nursery

if ($results=="Nursery")

Are you aware that that comparison is case-sensitive?

Also that code is poor. It should simply be

$results=isset($_GET['results']) ?  $_GET['results'] : NULL;

Do not use error suppression when you are learning something new.

And Oh, How can I prevent SQL injection in PHP?

8

solved How to compare two variables in php