Jump to content

$id = _GET ['id']; Not Working :/ Please Help.... URGENT!


davidfattore
Go to solution Solved by davidfattore,

Recommended Posts

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
Link to comment
Share on other sites

  • Solution

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 by davidfattore
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.