joomla3.5

PHP Isset Issue

拈花ヽ惹草 提交于 2020-02-05 03:25:25
问题 I am using isset() to check if a variable has a value. My issue is that even when the variable has no value (the parameter was not passed in the url) the sql string is still modified to append the where clause. For example - if this is the URL that is passed http://internal/test/trbm?userID=3213 And this is my php snippet $user = urldecode($_GET['userID']); $sql = "Select * from users" if (isset($user)) { $sql .= " WHERE userID = '$user'"; } echo $sql; The echo results are: Select * from

PHP Isset Issue

可紊 提交于 2020-02-05 03:25:07
问题 I am using isset() to check if a variable has a value. My issue is that even when the variable has no value (the parameter was not passed in the url) the sql string is still modified to append the where clause. For example - if this is the URL that is passed http://internal/test/trbm?userID=3213 And this is my php snippet $user = urldecode($_GET['userID']); $sql = "Select * from users" if (isset($user)) { $sql .= " WHERE userID = '$user'"; } echo $sql; The echo results are: Select * from