Hey guys,
Just wondering where I went wrong with this syntax.
I know its got something to do with the AND but not sure what.
$get = "SELECT fi, le, acc FROM us WHERE use ='". $_SESSION ["use"]."'"AND $_SESSION["tt"] = '1'";
$get = "SELECT fi, le, acc FROM us WHERE use ='". $_SESSION ["use"] . "' AND " . $_SESSION["tt"] . " = 1";
Or, I often use sprintf() so I don't have to keep track of all those quote and periods:
$get = sprintf( "SELECT fi, le, acc FROM us WHERE use ='%s' AND %s = 1", $_SESSION ["use"], $_SESSION["tt"] );
NogDog wrote:Or, I often use sprintf() so I don't have to keep track of all those quote and periods: $get = sprintf( "SELECT fi, le, acc FROM us WHERE use ='%s' AND %s = 1", $_SESSION ["use"], $_SESSION["tt"] );
Nice tip, thanks.