do query based on a var
Hi, is this the best way to switch a query
$index = $_GET['index'];
if ($index==1) $index=1;
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.
Originally Posted by sonny
$index = intval($_GET['index']);
Know what, I had no "ones" in the test column my host must have restored the database or
something while I was working. just trying to slime things down , like turning 3 pages into one,
whenever I can.
I thought I was losing it, I never had a database change on me like that. sometimes I can
be too quick to blame myself, note for the record I clean everything just never post that part
to keep things simple as well as use isset etc