MDCode Posted November 16, 2013 Share Posted November 16, 2013 (edited) That particular error message usually means the value in your WHERE clause is empty or null. In this case, id. Edited November 16, 2013 by SocialCloud Quote Link to comment https://forums.phpfreaks.com/topic/283964-id-_get-id-not-working-please-help-urgent/page/2/#findComment-1458628 Share on other sites More sharing options...
Zane Posted November 17, 2013 Share Posted November 17, 2013 The Code is below: <?php if((isset($_GET['id'])) && (is_numeric($_GET['id']))) { //accessed through viewusers. $id = $_GET['id']; } elseif ((isset($_POST['id'])) && (is_numeric($_POST['id']))) { //form has been subbed. $id = $_POST['id']; } else { print '<h2> Page Error </h2>'; print '<p class=error> This page has been accessed in error. </p>'; } ?> It's giving me the page error portion and not recognizing the $id Going back to the initial problem you mentioned in your OP. This problem can easily be solved by adding a $id = null; into your else statement. That is only one reason though why it is ruining your query. You where statement should be in a separate variable if you intend to collect all records at some point. instead of, or along with $id, you should have a variable called $where, that contains a string like this WHERE id = $id and give it a value of null when you don't need it as I explained in the beginning. So you query will look something like this instead SELECT blah.* FROM someTable $where Quote Link to comment https://forums.phpfreaks.com/topic/283964-id-_get-id-not-working-please-help-urgent/page/2/#findComment-1458639 Share on other sites More sharing options...
Solution davidfattore Posted November 18, 2013 Author Solution Share Posted November 18, 2013 (edited) Hey guys, thank you immensely for all the support, the problem has been solved! It turns out it was a problem with the hosting provider, in that they had just recently upgraded there MySQL server version and PHP versions (don't ask why, as they clearly didn't provide any notice to any of their customers prior to the upgrade). Edited November 18, 2013 by davidfattore Quote Link to comment https://forums.phpfreaks.com/topic/283964-id-_get-id-not-working-please-help-urgent/page/2/#findComment-1458775 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.