Quote:
Originally Posted by sonny
Hi, I am trying to do a query based on $index==1, but its always running the else
I know the get works coming in, because I can echo $title, or maybe you can't do
that with a query or something.
PHP Code:
$index = $_GET['index']; if ($index==1) { $index=1; $title="Index";// this works, but not the right query below? }
if ($index==1) $query1 = "SELECT COUNT(*) as num FROM $tbl WHERE test='1'"; else $query1 = "SELECT COUNT(*) as num FROM $tbl WHERE ip LIKE '$key'";
|
Doesn't make much sense why it doesn't, but try converting the $_GET['index'] to an integer(
intval) just for debugging purpose. Maybe the string interger comparison is conflicting although PHP automatically converts them for you during comparison.
PHP Code:
$index = intval($_GET['index']);